diff --git a/.gitignore b/.gitignore index b8b74b2..0eb41ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,13 @@ -build -dist *.pyc .* *~ -/src/cygapt/version.py + +# Autotools +# +Makefile.in +Makefile +/autom4te.cache/ +/aclocal.m4 +/build-aux/ +/configure +/config.* diff --git a/.travis.yml b/.travis.yml index 56d3455..8f1a2bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,10 @@ python: - "2.6" - "2.7" -install: - - make PYTHON=python - script: - - make test PYTHON=python + - autoreconf -i + - ./configure + - make distcheck notifications: email: false diff --git a/INSTALL.md b/INSTALL.md index 3700c62..44bd20e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,7 +1,7 @@ Installation Instructions ========================= -Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation, +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, @@ -12,36 +12,359 @@ without warranty of any kind. Basic Installation ------------------ - Briefly, the shell commands `make; make install` should -build, and install this package. + Briefly, the shell command `./configure && make && make install` +should configure, build, and install this package. The following +more-detailed instructions are generic; see the `README` file for +instructions specific to this package. Some packages provide this +`INSTALL` file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure` shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile` in each directory of the package. +It may also create one or more `.h` files containing system-dependent +definitions. Finally, it creates a shell script `config.status` that +you can run in the future to recreate the current configuration, and a +file `config.log` containing compiler output (useful mainly for +debugging `configure`). + + It can also use an optional file (typically called `config.cache` +and enabled with `--cache-file=config.cache` or simply `-C`) that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure` could check whether to do them, and mail +diffs or instructions to the address given in the `README` so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache` contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac` (or `configure.in`) is used to create +`configure` by a program called `autoconf`. You need `configure.ac` if +you want to change it or regenerate `configure` using a newer version +of `autoconf`. The simplest way to compile this package is: 1. `cd` to the directory containing the package's source code and type - `make package` to compile the package. + `./configure` to configure the package for your system. + + Running `configure` might take a while. While running, it prints + some messages telling which features it is checking for. - 2. Optionally, type `make test` to run any self-tests that come with + 2. Type `make` to compile the package. + + 3. Optionally, type `make check` to run any self-tests that come with the package, generally using the just-built uninstalled binaries. - 3. Type `make install` to install the programs and any data files and + 4. Type `make install` to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install` phase executed with root privileges. - 4. Optionally, type `make installtest` to repeat any self-tests, but + 5. Optionally, type `make installcheck` to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install` required root privileges, verifies that the installation completed correctly. - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean`. To also remove all - genereted fils type `make mrproper`. + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean`. To also remove the + files that `configure` created (so you can compile the package for + a different kind of computer), type `make distclean`. There is + also a `make maintainer-clean` target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall` to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck`, which can by used by developers to test that all other + targets like `make install` and `make uninstall` work correctly. + This target is generally not run by end users. + +Compilers and Options +--------------------- + + Some systems require unusual options for compilation or linking that +the `configure` script does not know about. Run `./configure --help` +for details on some of the pertinent environment variables. + + You can give `configure` initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +------------------------------------ + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make`. `cd` to the +directory where you want the object files and executables to go and run +the `configure` script. `configure` automatically checks for the +source code in the directory that `configure` is in and in `..`. This +is known as a "VPATH" build. + + With a non-GNU `make`, it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean` before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch` options to the +compiler but only a single `-arch` option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo` tool if you have problems. Installation Names ------------------ By default, `make install` installs the package's commands under -`/usr/bin`, share files under `/usr/share`, etc. +`/usr/local/bin`, include files under `/usr/local/include`, etc. You +can specify an installation prefix other than `/usr/local` by giving +`configure` the option `--prefix=PREFIX`, where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX` to `configure`, the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR` to specify different values for particular +kinds of files. Run `configure --help` for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}`, so that +specifying just `--prefix` will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure`; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install` command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory` will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}`. Any directories that were specified during `configure`, +but not in terms of `${prefix}`, must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR` variable. For +example, `make install DESTDIR=/alternate/directory` will prepend +`/alternate/directory` before all installation names. The approach of +`DESTDIR` overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}` +at `configure` time. + +Optional Features +----------------- + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure` the +option `--program-prefix=PREFIX` or `--program-suffix=SUFFIX`. + + Some packages pay attention to `--enable-FEATURE` options to +`configure`, where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE` options, where PACKAGE +is something like `gnu-as` or `x` (for the X Window System). The +`README` should mention any `--enable-` and `--with-` options that the +package recognizes. + + For packages that use the X Window System, `configure` can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure` options `--x-includes=DIR` and +`--x-libraries=DIR` to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make` will be. For these packages, running `./configure +--enable-silent-rules` sets the default to minimal output, which can be +overridden with `make V=1`; while running `./configure +--disable-silent-rules` sets the default to verbose, which can be +overridden with `make V=0`. + +Particular systems +------------------ + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make` updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure` are involved. Use GNU `make` +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `` header file. The option `-nodtk` can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb` early in your `PATH`. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin`. So, if you need `/usr/ucb` +in your `PATH`, put it _after_ `/usr/bin`. + + On Haiku, software installed for all users goes in `/boot/common`, +not `/usr/local`. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +-------------------------- + + There may be some features `configure` cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure` can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE` option. TYPE can either be a short name for the system +type, such as `sun4`, or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub` for the possible values of each field. If +`config.sub` isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE` to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE`. + +Sharing Defaults +---------------- + + If you want to set default values for `configure` scripts to share, +you can create a site shell script called `config.site` that gives +default values for variables like `CC`, `cache_file`, and `prefix`. +`configure` looks for `PREFIX/share/config.site` if it exists, then +`PREFIX/etc/config.site` if it exists. Or, you can set the +`CONFIG_SITE` environment variable to the location of the site script. +A warning: not all `configure` scripts look for a site script. + +Defining Variables +------------------ + + Variables not defined in a site shell script can be set in the +environment passed to `configure`. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure` command line, using `VAR=value`. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc` to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL` due to +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure` Invocation +---------------------- + + `configure` recognizes the following options to control how it +operates. + +`--help` +`-h` + Print a summary of all of the options to `configure`, and exit. + +`--help=short` +`--help=recursive` + Print a summary of the options unique to this package's + `configure`, and exit. The `short` variant lists options used + only in the top level, while the `recursive` variant lists options + also present in any nested packages. + +`--version` +`-V` + Print the version of Autoconf used to generate the `configure` + script, and exit. + +`--cache-file=FILE` + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache`. FILE defaults to `/dev/null` to + disable caching. + +`--config-cache` +`-C` + Alias for `--cache-file=config.cache`. + +`--quiet` +`--silent` +`-q` + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null` (any error + messages will still be shown). + +`--srcdir=DIR` + Look for the package's source code in directory DIR. Usually + `configure` can determine that directory automatically. + +`--prefix=DIR` + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create` +`-n` + Run the configure checks, but stop before creating any output + files. + +`configure` also accepts some other, not widely useful, options. Run +`configure --help` for more details. diff --git a/Makefile b/Makefile deleted file mode 100644 index 4588a46..0000000 --- a/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# Default target -all:: build tools doc - -# vars utils -UTIL_SPACE := $() # - -# Programs -SHELL_PATH = /bin/bash -CP = /bin/cp -f -RM = /bin/rm -f --preserve-root -MV = /bin/mv -MKDIR = /bin/mkdir -p -INSTALL = /bin/install -GZ = /bin/gzip --best -TAR = /bin/tar -PYTHON = /usr/bin/python -MAKE ?= /usr/bin/make - -# Source directories -SD_ROOT = $(subst $(UTIL_SPACE),\$(UTIL_SPACE),$(shell pwd)) -SD_BUILD = $(SD_ROOT)/build -SD_SRC = $(SD_ROOT)/src -SD_TEST = $(SD_ROOT)/test -SD_DIST = $(SD_ROOT)/dist -SD_DOC = $(SD_ROOT)/doc -SD_TOOLS = $(SD_ROOT)/tools - -# source environement -VERSION = 1.1.0rc1 -VERSION_FILE = VERSION-FILE~ -$(VERSION_FILE): FORCE - @$(SHELL_PATH) ./VERSION-GEN --include $(VERSION_FILE) - -# install environement -EXENAME = cyg-apt - -# Install directories -ID_ROOT = -ID_PREFIX = usr -ID_LOCALSTATE = var -ID_SYSCONF = etc -ID_LIBEXEC = $(ID_PREFIX)/lib -ID_EXEC = $(ID_PREFIX)/bin -ID_DATA = $(ID_PREFIX)/share -ID_MAN = $(ID_DATA)/man -ID_INFO = $(ID_DATA)/info - -build: FORCE - @cd $(SD_SRC); $(MAKE) - -doc: FORCE - @cd $(SD_DOC); $(MAKE) - -tools: FORCE - @cd $(SD_TOOLS); $(MAKE) - -test: build FORCE - @cd $(SD_TEST); $(MAKE) - -installtest: install FORCE - @cd $(SD_TEST); $(MAKE) $@ - -install: FORCE - @cd $(SD_SRC); $(MAKE) $@ - @cd $(SD_DOC); $(MAKE) $@ - @cd $(SD_TOOLS); $(MAKE) $@ - -$(SD_DIST)/$(EXENAME)-$(VERSION): build doc tools - $(MKDIR) $(SD_DIST)/$(EXENAME)-$(VERSION) - cd $(SD_BUILD); pwd; $(TAR) -jcf $(SD_DIST)/$(EXENAME)-$(VERSION)/$(EXENAME)-$(VERSION).tar.bz2 * - git archive --prefix="$(EXENAME)-$(VERSION)/" --format=tar HEAD | bzip2 -c > $(SD_DIST)/$(EXENAME)-$(VERSION)/$(EXENAME)-$(VERSION)-src.tar.bz2 - $(CP) setup.hint $(SD_DIST)/$(EXENAME)-$(VERSION) - -package: $(SD_DIST)/$(EXENAME)-$(VERSION) - -packageclean: - $(RM) -r $(SD_DIST) - -clean: FORCE - @cd $(SD_TEST); $(MAKE) $@ - @cd $(SD_SRC); $(MAKE) $@ - @cd $(SD_DOC); $(MAKE) $@ - @cd $(SD_TOOLS); $(MAKE) $@ - $(RM) $(VERSION_FILE) - -mrproper: FORCE clean packageclean - $(RM) -r $(SD_BUILD) - -.PHONY: FORCE -.EXPORT_ALL_VARIABLES: diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..5f66485 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,21 @@ +SUBDIRS = src doc tools + +DIST_SUBDIRS = $(SUBDIRS) \ + build-aux + +dist_doc_DATA = \ + AUTHORS \ + CONTRIBUTING.md \ + CONVENTIONS.md \ + COPYING \ + ChangeLog \ + INSTALL.md \ + LICENSE \ + NEWS.md \ + TODO \ + README.md + +ACLOCAL_AMFLAGS = -I m4 + +dist-hook: + echo '$(VERSION)' > $(distdir)/version diff --git a/NEWS.md b/NEWS.md index 9129d20..91278eb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -20,3 +20,12 @@ News - `///setup.ini` +* 1.1.0 () + + * the python library of this package is private so it does not install under + the standard python `site-package` directory but on `$(pkgdatadir)/python` + (default: `/usr/local/share/cyg-apt/python`) + + * to build from source it requires the `automake` package + + * the build command line: `autoreconf -i && ./configure && make` diff --git a/README.md b/README.md index 1bb3ffc..3e4a238 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,32 @@ Requirements Build requirements ------------------ -* `make` 3.80+ -* `git` 1.7+ +* `make` 3.59+ + +From source: + + * `automake` 1.9+ Install instructions -------------------- -Briefly the following commands should build, test and install this package. +From source please run `autoreconf` first to generate all required build scripts: + + $ autoreconf -i + +Briefly the following commands should configure, make and install this package: + + $ ./configure && make && make install + +Some features can be enable by giving to `configure` the option `--enable-FEATURE[=ARG]`: + + * If you want to install the **bash-completion** script then set the `--enable-bash-completion=DIR` option. + Where `DIR` may be one of the following directories: - $ make - $ make test - $ make install + - `pkg-config --variable=completionsdir bash-completion` + - `${BASH_COMPLETION_DIR}` + - `/etc/bash_completion.d` See the [`INSTALL.md`](INSTALL.md) file for more detailed instructions. diff --git a/TODO b/TODO index a362684..2b51fb7 100644 --- a/TODO +++ b/TODO @@ -5,5 +5,3 @@ Add missing tests For it help you to the source code of cygcheck under the cygwin package [ArgParser] Update usage with pretty argparse format ( subparser ? ) Add language translation -[Makefile] Add `make uninstall` -[Makefile] Add configure script for check dependency it must be set macro values diff --git a/VERSION-GEN b/VERSION-GEN deleted file mode 100644 index c0f4f68..0000000 --- a/VERSION-GEN +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# (c) GIT-VERSION-GEN - github.com/git/git - -if [ -z "$VERSION_FILE" ]; -then - VF="VERSION-FILE"; -else - VF="$VERSION_FILE"; -fi - -LF=' -' - -# First see if there is a version file (included in release tarballs), -# then try git-describe, then default. -if test -f version -then - VN=$(cat version) || VN="$VERSION" -elif test -d .git -o -f .git && - VN=$(git describe --match "v[0-9]*" --tags --abbrev=7 HEAD 2>/dev/null) && - case "$VN" in - *$LF*) (exit 1) ;; - v[0-9]*) - git update-index -q --refresh - test -z "$(git diff-index --name-only HEAD --)" || - VN="$VN-dirty" ;; - esac -then - # Format into cygwin version major.minor.micro-release[.] - oldIFS="$IFS"; - IFS="-"; - i=0; - VT=""; - for part in $VN; - do - case "$i" - in - '0') - VT+="$part"; - ;; - '1') - VT+="-$part"; - ;; - *) - VT+=".$part"; - ;; - esac; - (( i++ )); - done; - unset i; - IFS="$oldIFS" - VN="$VT"; -else - VN="$VERSION" -fi - -VN=$(expr "$VN" : v*'\(.*\)') - -if test -r $VF -then - VC=$(sed -e 's/^VERSION = //' <$VF) -else - VC=unset -fi - -test "$VN" = "$VC" || { - echo >&2 "VERSION = $VN" - echo "VERSION = $VN" >$VF -} - -exit 0; diff --git a/appveyor.yml b/appveyor.yml index 41fe411..a71d54d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,9 @@ environment: CYG_ROOT: C:/cygwin CYG_MIRROR: http://cygwin.uib.no CYG_CACHE: C:/cygwin/var/cache/setup + # need to set DJDIR because bash fail to read the file descriptor 0 + DJDIR: / + CYG_ENV: 'C:/cygwin/bin/bash -lc "cd \"$OLDPWD\" && ' matrix: - @@ -73,7 +76,7 @@ install: - 'if not "%PYTHON_PLATFORM%" == "cygwin" powershell ./.appveyor/install.ps1' - 'if not "%PYTHON_PLATFORM%" == "cygwin" dir "C:/python*"' - 'appveyor DownloadFile http://cygwin.com/setup-%CYG_ARCH%.exe -FileName setup.exe' - - 'setup.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P make -P python -P gnupg > NUL' + - 'setup.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P make -P python -P gnupg -P automake > NUL' - '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"' - '%PYTHON% --version' - '%PYTHON% -c "import sys; print(''Python architecture: {0}''.format(''x64'' if sys.maxsize > 2**32 else ''x86''))"' @@ -81,15 +84,22 @@ install: - 'if "2.6" == "%PYTHON_VERSION%" appveyor DownloadFile https://raw.githubusercontent.com/bewest/argparse/master/argparse.py -FileName %PYTHON_DIR%/Lib/site-packages/argparse.py' build_script: - - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make PYTHON=\"$PYTHON\""' + - '%CYG_ENV% autoreconf -i"' + - '%CYG_ENV% ./configure PYTHON=$PYTHON --prefix=\"`pwd`/_inst\""' test_script: - - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make test PYTHON=\"$PYTHON\""' - - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make install"' - - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"; make installtest PYTHON=\"$PYTHON\""' - - ps: 'cp $env:CYG_ROOT/home/$env:USERNAME/.cyg-apt -destination $env:HOMEPATH' - - '%PYTHON% %CYG_ROOT%/bin/cyg-apt update -qX' - - '%PYTHON% %CYG_ROOT%/bin/cyg-apt ball cygwin> ball~' + - '%CYG_ENV% make distcheck DISTCHECK_CONFIGURE_FLAGS=PYTHON=$PYTHON"' + # test architecture detection + - '%CYG_ENV% make install"' + - 'echo ROOT="%CYG_ROOT%/">.cyg-apt' + - 'echo cache="%CYG_CACHE%">>.cyg-apt' + - 'echo mirror="%CYG_MIRROR%">>.cyg-apt' + - 'echo distname="curr">>.cyg-apt' + - 'set PATH=%APPVEYOR_BUILD_FOLDER%\_inst\bin;%PATH%' + - 'if "%PYTHON_PLATFORM%" == "cygwin" %CYG_ENV% cyg-apt update -q"' + - 'if "%PYTHON_PLATFORM%" == "cygwin" %CYG_ENV% cyg-apt ball cygwin"> ball~' + - 'if not "%PYTHON_PLATFORM%" == "cygwin" cyg-apt update -q' + - 'if not "%PYTHON_PLATFORM%" == "cygwin" cyg-apt ball cygwin> ball~' - ps: 'Get-Content ball~ | set path; cmd /c $env:CYG_ROOT/bin/cygpath -w $path> ball~' - ps: 'Get-Content ball~' - ps: 'if (-not(Get-Content ball~ | Test-Path)) { Exit 1 }' diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am new file mode 100644 index 0000000..c6db8a5 --- /dev/null +++ b/build-aux/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = git-version-gen diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen new file mode 100755 index 0000000..ed73a52 --- /dev/null +++ b/build-aux/git-version-gen @@ -0,0 +1,78 @@ +#!/bin/sh +############## GNU GENERAL PUBLIC LICENSE, Version 3 #################### +# git-version-gen - Tool provides version auto-generation using git tags +# Copyright (C) 2012 Junio C Hamano +# loops +# Tay Ray Chuan +# Alexandre Quercia +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +######################################################################### + +VERSION=${VERSION='0.0.1'} + +while test 0 \< $#; do + case $1 in #( + --fallback=[0-9]*) + VERSION=`expr x"$1" : x'--fallback=\(.*\)'` + ;; #( + *) ;; + esac + + shift +done; + +committish='HEAD' +LF=' +' + + +# First see if there is a version file (included in release tarballs), +# then try git-describe, then default. +if test -f version +then + VN=$(cat version) || VN="$VERSION" +elif test -d .git -o -f .git && + VN=$(git describe --match "v[0-9]*" --tags --abbrev=7 $committish 2>/dev/null) && + case "$VN" in + *$LF*) (exit 1) ;; + v[0-9]*) + git update-index -q --refresh + test -z "$(git diff-index --name-only $committish --)" || + VN="$VN-dirty" ;; + esac +then + # replace the lead hyphen by a dot + # + # from: + # -[-dirty] + # to: + # .[-dirty] + # + VN=`sed -e 's,-\([1-9][0-9]*-g[0-9a-z]\{7\}\(-dirty\)\?\)$,.\\1,' </dev/null 2>&1) +CA_PROG_CYGPATH_M +CA_PATH_PROG(GPG, gpg) +CA_PATH_PROG(LN, ln) +CA_PATH_PROG(BASH, bash) +CA_PATH_PROG(PS, ps) +CA_PATH_PROG(XZ, xz) +CA_PATH_PROG(CYGCHECK, cygcheck, false) +CA_PATH_PROG(CYGPATH, cygpath, echo) +CA_PATH_PROG(ENV, env) + + +# checks for libraries +AS_VAR_IF( + PYTHON_VERSION, + 2.6, + [AC_MSG_CHECKING(for ${am_display_PYTHON} argparse module)] + [AS_IF( + ${PYTHON} -c [AS_ESCAPE(import argparse, [ ])] >/dev/null 2>&1, + [AC_MSG_RESULT(yes)], + [AC_MSG_FAILURE( + failed to find required ${am_display_PYTHON} argparse module + )]dnl + )], +) + + +# checks for header files + + +# checks for types + + +# checks for structures + + +# checks for compiler characteristics + + +# checks for library functions + + +# checks for system services + + +AC_CONFIG_FILES( + Makefile + build-aux/Makefile + src/Makefile + src/cygapt/config.py:src/cygapt/config.pyin + doc/Makefile + tools/Makefile +) +AC_OUTPUT diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index ed24861..0000000 --- a/doc/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -SRC = $(wildcard *.1) -D_BUILD = $(SD_BUILD)/$(ID_MAN) -D_MAN1 = man1 -MAN1 = $(D_MAN1)/$(EXENAME).1.gz -D_DOC = $(SD_BUILD)/$(ID_DATA)/doc/$(EXENAME) -ID_DOC = $(ID_ROOT)/$(ID_DATA)/doc - -INSTALL_DOCS = -INSTALL_DOCS += ../COPYING -INSTALL_DOCS += ../LICENSE -INSTALL_DOCS += ../README.md -INSTALL_DOCS += ../ChangeLog -INSTALL_DOCS += ../INSTALL.md -INSTALL_DOCS += ../TODO -INSTALL_DOCS += ../AUTHORS - -all:: $(D_BUILD)/$(MAN1) doc - -$(D_BUILD): - $(MKDIR) $(D_BUILD)/$(D_MAN1) - -$(D_BUILD)/$(MAN1): $(SRC) $(D_BUILD) - $(GZ) -c "$<" > "$@" - $(GZ) -t "$@" - -doc: $(INSTALL_DOCS) - @$(MKDIR) $(D_DOC) - $(CP) $^ $(D_DOC) - -doc-install: doc - $(INSTALL) -d -m 755 $(ID_DOC) - $(CP) -r $(D_DOC) $(ID_DOC) - -install: $(D_BUILD)/$(MAN1) doc-install - $(INSTALL) -d -m 755 $(ID_ROOT)/$(ID_MAN)/$(D_MAN1) - $(INSTALL) "$<" $(ID_ROOT)/$(ID_MAN)/$(D_MAN1) - -clean: FORCE - - -.PHONY: FORCE -.EXPORT_ALL_VARIABLES: diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..3062636 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,8 @@ +dist_man1_MANS = cyg-apt.1 + +CLEANFILES = cyg-apt.1 +EXTRA_DIST = man.1 + +cyg-apt.1: $(srcdir)/man.1 + gzip -c $^ > $@ + gzip -t $@ diff --git a/m4/ca_normalize_path.m4 b/m4/ca_normalize_path.m4 new file mode 100644 index 0000000..9449b52 --- /dev/null +++ b/m4/ca_normalize_path.m4 @@ -0,0 +1,17 @@ +# CA_NORMALIZE_PATH(PATH) +# ----------------------- +# +# replace backslashes with slash +# +AC_DEFUN([CA_NORMALIZE_PATH], [ + AS_CASE( + ${$1}, + *[AS_ESCAPE(\)]*, + [AC_MSG_CHECKING(for $1 without backslash)] + [AS_VAR_SET( + $1, + `[AS_ECHO(${$1})] | tr [AS_ESCAPE([AS_ESCAPE(\\)])] /`, + )] + [AC_MSG_RESULT(${$1})], + ) +]) diff --git a/m4/ca_path_prog.m4 b/m4/ca_path_prog.m4 new file mode 100644 index 0000000..8e6742a --- /dev/null +++ b/m4/ca_path_prog.m4 @@ -0,0 +1,31 @@ +# CA_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH = $PATH]) +# ------------------------------------------------------------------------------- +# +# extends AC_PATH_PROG +# requires CA_PROG_CYGPATH_M +# define DOS_$1 as dos path +# mark the $1 and DOS_$1 as precious with AC_ARG_VAR +# +AC_DEFUN([CA_PATH_PROG], [ + AC_REQUIRE([CA_PROG_CYGPATH_M])dnl + AC_PATH_PROG($1, $2, $3, $4) + AS_VAR_IF( + $1, + [], + [AC_MSG_FAILURE([AS_ESCAPE(the $2 program could not be found in $PATH)])], + ) + AC_ARG_VAR($1, the $2 program) + # checking for $2 program with dos path + AC_CACHE_CHECK( + for $2 with dos path, + ca_cv_dospath_$1, + [AS_VAR_IF( + DOS_$1, + [], + [AS_VAR_SET(ca_cv_dospath_$1, `${CYGPATH_M} ${$1}`)], + [AS_VAR_SET(ca_cv_dospath_$1, ${DOS_$1})] + )], + ) + AC_SUBST(DOS_$1, ${ca_cv_dospath_$1}) + AC_ARG_VAR(DOS_$1, the $2 program with dos path) +]) diff --git a/m4/ca_path_python.m4 b/m4/ca_path_python.m4 new file mode 100644 index 0000000..962aa14 --- /dev/null +++ b/m4/ca_path_python.m4 @@ -0,0 +1,26 @@ +# CA_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [MAXIMUM-VERSION]) +# ---------------------------------------------------------------------------------------------- +# +# extends AM_PATH_PYTHON +# checks for $PYTHON is older than MINIMUM-VERSION +# +AC_DEFUN([CA_PATH_PYTHON], [ + AM_PATH_PYTHON( + $1, + [CA_NORMALIZE_PATH(pyexecdir)] + [CA_NORMALIZE_PATH(pythondir)] + [AS_IF( + test x != x"$4", + [AC_MSG_CHECKING(whether ${am_display_PYTHON} version is < $4)] + [AM_PYTHON_CHECK_VERSION( + ${PYTHON}, + $4, + [AC_MSG_RESULT(no)] + [AC_MSG_ERROR(Python interpreter is too new)], + [AC_MSG_RESULT(yes)], + )], + )] + $2, + $3, + ) +]) diff --git a/m4/ca_prog_cygpath_m.m4 b/m4/ca_prog_cygpath_m.m4 new file mode 100644 index 0000000..fc5e55c --- /dev/null +++ b/m4/ca_prog_cygpath_m.m4 @@ -0,0 +1,30 @@ +# CA_PROG_CYGPATH_M +# ----------------- +# +# define CYGPATH_M +# requires AC_PATH_PYTHON +# +AC_DEFUN([CA_PROG_CYGPATH_M], [ + { + AC_PATH_PROG(CYGPATH, cygpath) + } AS_MESSAGE_FD>/dev/null AS_MESSAGE_LOG_FD>/dev/null + AC_CACHE_CHECK( + for cygpath -m, + ca_cv_path_cygpath_m, + [AS_VAR_IF( + CYGPATH, + [], + [AS_VAR_SET(ca_cv_path_cygpath_m, echo)], + [AS_VAR_SET( + ca_cv_path_cygpath_m, + [AS_ESCAPE(${CYGPATH} -m, [ ])], + )], + )] + [AS_IF( + ${ca_cv_path_cygpath_m} --version >/dev/null 2>/dev/null, + [], + [AS_VAR_SET(ca_cv_path_cygpath_m, echo)]dnl + )], + ) + AC_SUBST(CYGPATH_M, ${ca_cv_path_cygpath_m}) +]) diff --git a/setup.hint b/setup.hint deleted file mode 100644 index da68c2d..0000000 --- a/setup.hint +++ /dev/null @@ -1,5 +0,0 @@ -category: Admin Utils -requires: cygwin coreutils python python-argparse gnupg -sdesc: "A Cygwin package manager" -ldesc: "A Cygwin package manager. -Allows you to install and remove packages on the command line, and provides other package management functions. It has a command syntax similar to apt-get and dpkg." diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index e3b6476..0000000 --- a/src/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -SRC = main.py -D_BUILD = $(SD_BUILD)/$(ID_EXEC) -EXEC = $(EXENAME) -PYPKG = cygapt -PY_VERSION_FILE = $(PYPKG)/version.py -SRCLIB = $(wildcard $(PYPKG)/*.py) - -GPG_CYGWIN_PUBKEY = cygwin.sig - -all:: $(D_BUILD)/$(EXEC) - -$(D_BUILD): - $(MKDIR) $(D_BUILD) - $(MKDIR) $(SD_BUILD)/$(ID_SYSCONF)/postinstall - $(MKDIR) $(SD_BUILD)/$(ID_DATA)/$(EXENAME) - -$(D_BUILD)/$(EXEC): $(SRC) $(SRCLIB) $(D_BUILD) - $(SHELL_PATH) ./postinstall-gen.sh > $(SD_BUILD)/$(ID_SYSCONF)/postinstall/$(EXENAME).sh - $(CP) $(SD_ROOT)/LICENSE $(PYPKG) - @echo "__version__ = '$(VERSION)'" > $(PY_VERSION_FILE) - $(PYTHON) setup.py install --root="../build" - $(RM) $(PYPKG)/LICENSE - $(CP) $(GPG_CYGWIN_PUBKEY) $(SD_BUILD)/$(ID_DATA)/$(EXENAME) - $(CP) "$<" "$@" - -install: $(D_BUILD)/$(EXEC) - $(INSTALL) -d -m 755 $(ID_ROOT)/$(ID_DATA)/$(EXENAME) - $(INSTALL) $(GPG_CYGWIN_PUBKEY) $(ID_ROOT)/$(ID_DATA)/$(EXENAME) - $(INSTALL) -m 755 "$<" $(ID_ROOT)/$(ID_EXEC) - $(PYTHON) setup.py install - $(INSTALL) $(SD_BUILD)/$(ID_SYSCONF)/postinstall/$(EXENAME).sh $(ID_ROOT)/$(ID_SYSCONF)/postinstall - $(SHELL_PATH) $(ID_ROOT)/$(ID_SYSCONF)/postinstall/$(EXENAME).sh - $(MV) $(ID_ROOT)/$(ID_SYSCONF)/postinstall/$(EXENAME).sh $(ID_ROOT)/$(ID_SYSCONF)/postinstall/$(EXENAME).sh.done - -clean: FORCE - $(PYTHON) setup.py clean - $(RM) -r build dist $(PY_VERSION_FILE) - -.PHONY: FORCE -.EXPORT_ALL_VARIABLES: diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..0d42ae9 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,116 @@ +dist_pkgdata_DATA = cygwin.sig + +if CA_WANT_BATCH + bin_SCRIPTS = cyg-apt.bat +else + bin_SCRIPTS = cyg-apt +endif + +CLEANFILES = cyg-apt \ + cyg-apt.bat \ + cyg-apt.py + +EXTRA_DIST = main.py \ + main.batin + +check-local: + cd $(srcdir) && $(PYTHON) -m cygapt.test.__main__ -v + +installcheck-local: + cd '$(DESTDIR)$(private_pythondir)' && $(PYTHON) -m cygapt.test.__main__ -v + +install-data-hook: + $(POST_INSTALL) + if test x = x"$(DESTDIR)"; then \ + $(GPG) --import --no-secmem-warning '$(pkgdatadir)/cygwin.sig' \ + && if expr x"$(PYTHON_PLATFORM)" : x'cygwin.*' >/dev/null 2>&1; then \ + '$(bindir)/cyg-apt' setup -q; \ + else :; \ + fi \ + else :; \ + fi + +.PHONY: cyg-apt +cyg-apt: $(srcdir)/main.py + cat $^ \ + | $(SED) \ + -e s,'@'ENV'@','$(ENV)',g \ + -e s,'@'PYTHON'@','$(PYTHON)',g \ + -e s,'@'pkglibdir'@','$(private_pythondir)',g \ + -e s,'@'dos_pkglibdir'@','$(shell $(CYGPATH_M) '$(private_pythondir)')',g \ + > $@ + +.PHONY: cyg-apt.bat +cyg-apt.bat: $(srcdir)/main.batin + cat $^ \ + | $(SED) \ + -e s,'@'PYTHON'@','$(shell $(CYGPATH_M) '$(PYTHON)')',g \ + -e s,'@'mainpath'@','$(shell $(CYGPATH_M) '$(private_pythondir)/cyg-apt.py')',g \ + > $@ + +.PHONY: cyg-apt.py +cyg-apt.py: $(srcdir)/main.py + cat $^ \ + | $(SED) \ + -e s,'@'pkglibdir'@','$(private_pythondir)',g \ + -e s,'@'dos_pkglibdir'@','$(shell $(CYGPATH_M) '$(private_pythondir)')',g \ + > $@ + +private_pythondir = $(pkgdatadir)/python +private_python_PYTHON = cyg-apt.py + +private_python_cygaptdir = $(private_pythondir)/cygapt +private_python_cygapt_PYTHON = \ + cygapt/__init__.py \ + cygapt/argparser.py \ + cygapt/copying.py \ + cygapt/cygapt.py \ + cygapt/exception.py \ + cygapt/main.py \ + cygapt/ob.py \ + cygapt/path_mapper.py \ + cygapt/setup.py \ + cygapt/structure.py \ + cygapt/url_opener.py \ + cygapt/utils.py \ + cygapt/config.py + +private_python_cygapt_testdir = $(private_python_cygaptdir)/test +private_python_cygapt_test_PYTHON = \ + cygapt/test/__init__.py \ + cygapt/test/__main__.py \ + cygapt/test/test_argparser.py \ + cygapt/test/test_cygapt.py \ + cygapt/test/test_ob.py \ + cygapt/test/test_path_mapper.py \ + cygapt/test/test_setup.py \ + cygapt/test/test_url_opener.py \ + cygapt/test/test_utils.py \ + cygapt/test/utils.py + +private_python_cygapt_test_casedir = $(private_python_cygapt_testdir)/case +private_python_cygapt_test_case_PYTHON = \ + cygapt/test/case/__init__.py \ + cygapt/test/case/exception.py + +private_python_cygapt_test_case_py2dir = $(private_python_cygapt_test_casedir)/py2 +private_python_cygapt_test_case_py2_PYTHON = \ + cygapt/test/case/py2/__init__.py \ + cygapt/test/case/py2/exception.py + +private_python_cygapt_test_case_py2_minor6dir = $(private_python_cygapt_test_case_py2dir)/minor6 +private_python_cygapt_test_case_py2_minor6_PYTHON = \ + cygapt/test/case/py2/minor6/__init__.py \ + cygapt/test/case/py2/minor6/exception.py + +private_python_cygapt_test_fixturesdir = $(private_python_cygapt_testdir)/fixtures + +private_python_cygapt_test_fixtures_utilsdir = $(private_python_cygapt_test_fixturesdir)/utils +dist_private_python_cygapt_test_fixtures_utils_DATA = \ + cygapt/test/fixtures/utils/README \ + cygapt/test/fixtures/utils/cyglsa-bad1.dll \ + cygapt/test/fixtures/utils/cyglsa-bad2.dll \ + cygapt/test/fixtures/utils/cyglsa-bad3.dll \ + cygapt/test/fixtures/utils/cyglsa-bad4.dll \ + cygapt/test/fixtures/utils/cyglsa.dll \ + cygapt/test/fixtures/utils/cyglsa64.dll diff --git a/src/cygapt/__init__.py b/src/cygapt/__init__.py index 5bb2b4b..1d7e7df 100644 --- a/src/cygapt/__init__.py +++ b/src/cygapt/__init__.py @@ -13,6 +13,6 @@ from __future__ import absolute_import; -import cygapt.version as version; +import cygapt.config as config; -__version__ = version.__version__; +__version__ = config.VERSION; diff --git a/src/cygapt/config.pyin b/src/cygapt/config.pyin new file mode 100644 index 0000000..169c9f6 --- /dev/null +++ b/src/cygapt/config.pyin @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +######################## BEGIN LICENSE BLOCK ######################## +# This file is part of the cygapt package. +# +# Copyright (C) 2002-2009 Jan Nieuwenhuizen +# 2002-2009 Chris Cormie +# 2012 James Nylen +# 2012-2014 Alexandre Quercia +# +# For the full copyright and license information, please view the +# LICENSE file that was distributed with this source code. +######################### END LICENSE BLOCK ######################### + +# @configure_input@ + +import sys; + +# Version number of package +VERSION = r'@VERSION@'; + +if sys.platform.startswith('win') : + # Define the gpg program path + GPG = r'@DOS_GPG@'; + + # Define the ln program path + LN = r'@DOS_LN@'; + + # Define the bash program path + BASH = r'@DOS_BASH@'; + + # Define the ps program path + PS = r'@DOS_PS@'; + + # Define the xz program path + XZ = r'@DOS_XZ@'; + + # Define the cygcheck program path + CYGCHECK = r'@DOS_CYGCHECK@'; + + # Define the cygpath program path + CYGPATH = r'@DOS_CYGPATH@'; +else: + # Define the gpg program path + GPG = r'@GPG@'; + + # Define the ln program path + LN = r'@LN@'; + + # Define the bash program path + BASH = r'@BASH@'; + + # Define the ps program path + PS = r'@PS@'; + + # Define the xz program path + XZ = r'@XZ@'; + + # Define the cygcheck program path + CYGCHECK = r'@CYGCHECK@'; + + # Define the cygpath program path + CYGPATH = r'@CYGPATH@'; diff --git a/src/cygapt/cygapt.py b/src/cygapt/cygapt.py index d8b10a6..c672b0c 100644 --- a/src/cygapt/cygapt.py +++ b/src/cygapt/cygapt.py @@ -31,6 +31,11 @@ from cygapt.exception import UnexpectedValueException; from cygapt.path_mapper import PathMapper; from cygapt.structure import ConfigStructure; +from cygapt.config import LN; +from cygapt.config import BASH; +from cygapt.config import PS; +from cygapt.config import XZ; +from cygapt.config import CYGCHECK; class CygApt: INSTALLED_DB_MAGIC = "INSTALLED.DB 2\n"; @@ -96,7 +101,7 @@ def __init__(self, # DOS specific if not self.__cygwinPlatform: self.__lnExists = os.path.exists( - "{0}/bin/ln.exe".format(self.__prefixRoot) + self.__pm.mapPath(LN) ); else: self.__lnExists = True; @@ -206,7 +211,7 @@ def setRC(self, rc_structure): def _checkForSetupExe(self): # It's far from bulletproof, but it's surprisingly hard to detect # setup.exe running since it doesn't lock any files. - p = os.popen(self.__pm.mapPath("/bin/ps -W")); + p = os.popen(self.__pm.mapPath(PS+" -W")); psout = p.readlines(); p.close(); setup_re = re.compile(r"(? 0: raise OSError("fail to create links"); @@ -597,7 +599,7 @@ def _compressFollowingTargetExtension(self, srcPath, targetPath): f.close(); os.remove(srcPath); elif "xz" == compression : - subprocess.check_call(['xz', '-f', srcPath]); + subprocess.check_call([XZ, '-f', srcPath]); def _md5Sum(self, path): """Generate the md5sum from a file. diff --git a/src/cygapt/utils.py b/src/cygapt/utils.py index ef61bad..b0ac1c3 100644 --- a/src/cygapt/utils.py +++ b/src/cygapt/utils.py @@ -30,9 +30,10 @@ from cygapt.exception import UnexpectedValueException; from cygapt.url_opener import CygAptURLopener; from cygapt.structure import ConfigStructure; +from cygapt.config import CYGPATH; def cygpath(path): - p = os.popen("cygpath \"{0}\"".format(path)); + p = os.popen(CYGPATH+" \"{0}\"".format(path)); dospath = p.read().strip(); p.close(); return dospath; diff --git a/src/main.batin b/src/main.batin new file mode 100644 index 0000000..04a19bf --- /dev/null +++ b/src/main.batin @@ -0,0 +1,2 @@ +@echo off +"@PYTHON@" "@mainpath@" %* diff --git a/src/main.py b/src/main.py index a7ec45b..c229324 100644 --- a/src/main.py +++ b/src/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!@ENV@ @PYTHON@ # -*- coding: utf-8 -*- ######################## BEGIN LICENSE BLOCK ######################## # This file is part of the cygapt package. @@ -14,6 +14,17 @@ from __future__ import absolute_import; +import sys; +import os; + +if sys.platform.startswith('win') : + pkglibdir = os.path.normcase(r'@dos_pkglibdir@').capitalize(); +else: + pkglibdir = r'@pkglibdir@'; + +if pkglibdir not in sys.path : + sys.path.insert(0, pkglibdir); + from cygapt.main import CygAptMain; if __name__ == "__main__": diff --git a/src/postinstall-gen.sh b/src/postinstall-gen.sh deleted file mode 100644 index f8e0bf4..0000000 --- a/src/postinstall-gen.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -if [ -z "$ID_PREFIX" ]; -then - ID_PREFIX="usr"; -fi; - -if [ -z "$ID_EXEC" ]; -then - ID_EXEC="$ID_PREFIX/bin"; -fi; - -if [ -z "$ID_DATA" ]; -then - ID_DATA="$ID_PREFIX/share"; -fi; - -if [ -z "$EXENAME" ]; -then - EXENAME="cyg-apt"; -fi; - -if [ -z "$GPG_CYGWIN_PUBKEY" ]; -then - GPG_CYGWIN_PUBKEY="cygwin.sig"; -fi; - -echo "#!/bin/bash -# Add Cygwin's public key to the gpg keyring -/usr/bin/gpg --import --no-secmem-warning \"$ID_ROOT/$ID_DATA/$EXENAME/$GPG_CYGWIN_PUBKEY\" - -# Initialize $EXEC -\"$ID_ROOT/$ID_EXEC/$EXENAME\" setup -"; - -exit 0; diff --git a/src/setup.py b/src/setup.py deleted file mode 100644 index 9c08f6c..0000000 --- a/src/setup.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -######################## BEGIN LICENSE BLOCK ######################## -# This file is part of the cygapt package. -# -# Copyright (C) 2002-2009 Jan Nieuwenhuizen -# 2002-2009 Chris Cormie -# 2012 James Nylen -# 2012-2014 Alexandre Quercia -# -# For the full copyright and license information, please view the -# LICENSE file that was distributed with this source code. -######################### END LICENSE BLOCK ######################### - -from __future__ import absolute_import; - -from distutils.core import setup; -import os; - -realpathfile = os.path.realpath(os.path.dirname(__file__)); -realpathcwd = os.path.realpath(os.getcwd()); - -if realpathfile != realpathcwd: - os.chdir(realpathfile); - -try: - version = os.environ['VERSION']; -except KeyError: - version = "1.1.0rc1"; - -try: - pkgname = os.environ['PYPKG']; -except KeyError: - pkgname = "cygapt"; - -f = open("../README.md"); -long_description = f.read(); -f.close(); - -setup( - name=pkgname, - packages=[ - 'cygapt', - 'cygapt.test', - 'cygapt.test.case', - 'cygapt.test.case.py2', - 'cygapt.test.case.py2.minor6', - ], - package_data={pkgname: [ - 'LICENSE', - 'test/fixtures/utils/*', - ]}, - version=version, - description="A Cygwin command line package management tool.", - long_description=long_description, - license="GPL-3.0", - url="https://github.com/nylen/cyg-apt", - author="Jan Nieuwenhuizen, Chris Cormie, James Nylen, Alexandre Quercia", - author_email="cjcormie@gmail.com, janneke@gnu.org, jnylen@gmail.com, alquerci@email.com", - maintainer="Alexandre Quercia", - maintainer_email="alquerci@email.com", - platforms="cygwin", - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: GNU General Public License, Version 3', - 'Operating System :: Microsoft :: Windows', - 'Programming Language :: Python', - ], -); - -os.chdir(realpathcwd); diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index 80c4b90..0000000 --- a/test/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -all:: sourcetest - -TEST_SCRIPT = -m cygapt.test.__main__ -ARGUMENTS = -ARGUMENTS += -v - -# Print a warning each time it occurs, used for deprecation tests -# see https://docs.python.org/2/using/cmdline.html#cmdoption-W -PYTHON += -Wall - -sourcetest: FORCE - cd $(SD_SRC); $(PYTHON) $(TEST_SCRIPT) $(ARGUMENTS) - -installtest: FORCE - @$(PYTHON) $(TEST_SCRIPT) $(ARGUMENTS) - -clean: FORCE - - -.PHONY: FORCE -.EXPORT_ALL_VARIABLES: diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index ed63b3d..0000000 --- a/tools/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -SRC = completion.bash -D_COMPLETION = bash_completion.d -D_BUILD = $(SD_BUILD)/$(ID_SYSCONF)/$(D_COMPLETION) -EXEC = $(EXENAME) - -all:: $(D_BUILD)/$(EXEC) - -$(D_BUILD): - $(MKDIR) $(D_BUILD) - -$(D_BUILD)/$(EXEC): $(SRC) $(D_BUILD) - $(CP) "$<" "$@" - -install: $(D_BUILD)/$(EXEC) - $(INSTALL) -d -m 755 $(ID_ROOT)/$(ID_SYSCONF)/$(D_COMPLETION) - $(INSTALL) -m 755 "$<" $(ID_ROOT)/$(ID_SYSCONF)/$(D_COMPLETION) - -clean: FORCE - - -.PHONY: FORCE -.EXPORT_ALL_VARIABLES: diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..db0e707 --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,9 @@ +if CA_WANT_BASH_COMPLETION + dist_bash_completion_SCRIPTS = cyg-apt +endif + +CLEANFILES = cyg-apt +EXTRA_DIST = completion.bash + +cyg-apt: $(srcdir)/completion.bash + cp $^ $@