summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-09-15 18:43:42 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-09-15 18:43:42 +0000
commite9e2f9d911f61127cb02c41272cdb800b8baad04 (patch)
tree7d9439e5454a43021901fcefdb9b350f329bad8f
parent2d23378be7cf5ec656044bc7d036149138fd7a4c (diff)
Ethumb is now autotoolized
SVN revision: 52320
-rw-r--r--ChangeLog0
-rw-r--r--INSTALL365
-rw-r--r--Makefile.am150
-rw-r--r--NEWS0
-rw-r--r--README28
-rwxr-xr-xautogen.sh7
-rwxr-xr-xbuild.sh105
-rw-r--r--configure.ac180
-rw-r--r--ez_setup.py272
-rw-r--r--m4/cython.m477
-rw-r--r--m4/python.m467
-rw-r--r--python-ethumb.pc.in10
-rw-r--r--python-ethumb_client.pc.in10
-rw-r--r--setup.cfg8
-rw-r--r--setup.py135
15 files changed, 879 insertions, 535 deletions
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..7d1c323
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,365 @@
1Installation Instructions
2*************************
3
4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
52006, 2007, 2008, 2009 Free Software Foundation, Inc.
6
7 Copying and distribution of this file, with or without modification,
8are permitted in any medium without royalty provided the copyright
9notice and this notice are preserved. This file is offered as-is,
10without warranty of any kind.
11
12Basic Installation
13==================
14
15 Briefly, the shell commands `./configure; make; make install' should
16configure, build, and install this package. The following
17more-detailed instructions are generic; see the `README' file for
18instructions specific to this package. Some packages provide this
19`INSTALL' file but do not implement all of the features documented
20below. The lack of an optional feature in a given package is not
21necessarily a bug. More recommendations for GNU packages can be found
22in *note Makefile Conventions: (standards)Makefile Conventions.
23
24 The `configure' shell script attempts to guess correct values for
25various system-dependent variables used during compilation. It uses
26those values to create a `Makefile' in each directory of the package.
27It may also create one or more `.h' files containing system-dependent
28definitions. Finally, it creates a shell script `config.status' that
29you can run in the future to recreate the current configuration, and a
30file `config.log' containing compiler output (useful mainly for
31debugging `configure').
32
33 It can also use an optional file (typically called `config.cache'
34and enabled with `--cache-file=config.cache' or simply `-C') that saves
35the results of its tests to speed up reconfiguring. Caching is
36disabled by default to prevent problems with accidental use of stale
37cache files.
38
39 If you need to do unusual things to compile the package, please try
40to figure out how `configure' could check whether to do them, and mail
41diffs or instructions to the address given in the `README' so they can
42be considered for the next release. If you are using the cache, and at
43some point `config.cache' contains results you don't want to keep, you
44may remove or edit it.
45
46 The file `configure.ac' (or `configure.in') is used to create
47`configure' by a program called `autoconf'. You need `configure.ac' if
48you want to change it or regenerate `configure' using a newer version
49of `autoconf'.
50
51 The simplest way to compile this package is:
52
53 1. `cd' to the directory containing the package's source code and type
54 `./configure' to configure the package for your system.
55
56 Running `configure' might take a while. While running, it prints
57 some messages telling which features it is checking for.
58
59 2. Type `make' to compile the package.
60
61 3. Optionally, type `make check' to run any self-tests that come with
62 the package, generally using the just-built uninstalled binaries.
63
64 4. Type `make install' to install the programs and any data files and
65 documentation. When installing into a prefix owned by root, it is
66 recommended that the package be configured and built as a regular
67 user, and only the `make install' phase executed with root
68 privileges.
69
70 5. Optionally, type `make installcheck' to repeat any self-tests, but
71 this time using the binaries in their final installed location.
72 This target does not install anything. Running this target as a
73 regular user, particularly if the prior `make install' required
74 root privileges, verifies that the installation completed
75 correctly.
76
77 6. You can remove the program binaries and object files from the
78 source code directory by typing `make clean'. To also remove the
79 files that `configure' created (so you can compile the package for
80 a different kind of computer), type `make distclean'. There is
81 also a `make maintainer-clean' target, but that is intended mainly
82 for the package's developers. If you use it, you may have to get
83 all sorts of other programs in order to regenerate files that came
84 with the distribution.
85
86 7. Often, you can also type `make uninstall' to remove the installed
87 files again. In practice, not all packages have tested that
88 uninstallation works correctly, even though it is required by the
89 GNU Coding Standards.
90
91 8. Some packages, particularly those that use Automake, provide `make
92 distcheck', which can by used by developers to test that all other
93 targets like `make install' and `make uninstall' work correctly.
94 This target is generally not run by end users.
95
96Compilers and Options
97=====================
98
99 Some systems require unusual options for compilation or linking that
100the `configure' script does not know about. Run `./configure --help'
101for details on some of the pertinent environment variables.
102
103 You can give `configure' initial values for configuration parameters
104by setting variables in the command line or in the environment. Here
105is an example:
106
107 ./configure CC=c99 CFLAGS=-g LIBS=-lposix
108
109 *Note Defining Variables::, for more details.
110
111Compiling For Multiple Architectures
112====================================
113
114 You can compile the package for more than one kind of computer at the
115same time, by placing the object files for each architecture in their
116own directory. To do this, you can use GNU `make'. `cd' to the
117directory where you want the object files and executables to go and run
118the `configure' script. `configure' automatically checks for the
119source code in the directory that `configure' is in and in `..'. This
120is known as a "VPATH" build.
121
122 With a non-GNU `make', it is safer to compile the package for one
123architecture at a time in the source code directory. After you have
124installed the package for one architecture, use `make distclean' before
125reconfiguring for another architecture.
126
127 On MacOS X 10.5 and later systems, you can create libraries and
128executables that work on multiple system types--known as "fat" or
129"universal" binaries--by specifying multiple `-arch' options to the
130compiler but only a single `-arch' option to the preprocessor. Like
131this:
132
133 ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
134 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
135 CPP="gcc -E" CXXCPP="g++ -E"
136
137 This is not guaranteed to produce working output in all cases, you
138may have to build one architecture at a time and combine the results
139using the `lipo' tool if you have problems.
140
141Installation Names
142==================
143
144 By default, `make install' installs the package's commands under
145`/usr/local/bin', include files under `/usr/local/include', etc. You
146can specify an installation prefix other than `/usr/local' by giving
147`configure' the option `--prefix=PREFIX', where PREFIX must be an
148absolute file name.
149
150 You can specify separate installation prefixes for
151architecture-specific files and architecture-independent files. If you
152pass the option `--exec-prefix=PREFIX' to `configure', the package uses
153PREFIX as the prefix for installing programs and libraries.
154Documentation and other data files still use the regular prefix.
155
156 In addition, if you use an unusual directory layout you can give
157options like `--bindir=DIR' to specify different values for particular
158kinds of files. Run `configure --help' for a list of the directories
159you can set and what kinds of files go in them. In general, the
160default for these options is expressed in terms of `${prefix}', so that
161specifying just `--prefix' will affect all of the other directory
162specifications that were not explicitly provided.
163
164 The most portable way to affect installation locations is to pass the
165correct locations to `configure'; however, many packages provide one or
166both of the following shortcuts of passing variable assignments to the
167`make install' command line to change installation locations without
168having to reconfigure or recompile.
169
170 The first method involves providing an override variable for each
171affected directory. For example, `make install
172prefix=/alternate/directory' will choose an alternate location for all
173directory configuration variables that were expressed in terms of
174`${prefix}'. Any directories that were specified during `configure',
175but not in terms of `${prefix}', must each be overridden at install
176time for the entire installation to be relocated. The approach of
177makefile variable overrides for each directory variable is required by
178the GNU Coding Standards, and ideally causes no recompilation.
179However, some platforms have known limitations with the semantics of
180shared libraries that end up requiring recompilation when using this
181method, particularly noticeable in packages that use GNU Libtool.
182
183 The second method involves providing the `DESTDIR' variable. For
184example, `make install DESTDIR=/alternate/directory' will prepend
185`/alternate/directory' before all installation names. The approach of
186`DESTDIR' overrides is not required by the GNU Coding Standards, and
187does not work on platforms that have drive letters. On the other hand,
188it does better at avoiding recompilation issues, and works well even
189when some directory options were not specified in terms of `${prefix}'
190at `configure' time.
191
192Optional Features
193=================
194
195 If the package supports it, you can cause programs to be installed
196with an extra prefix or suffix on their names by giving `configure' the
197option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
198
199 Some packages pay attention to `--enable-FEATURE' options to
200`configure', where FEATURE indicates an optional part of the package.
201They may also pay attention to `--with-PACKAGE' options, where PACKAGE
202is something like `gnu-as' or `x' (for the X Window System). The
203`README' should mention any `--enable-' and `--with-' options that the
204package recognizes.
205
206 For packages that use the X Window System, `configure' can usually
207find the X include and library files automatically, but if it doesn't,
208you can use the `configure' options `--x-includes=DIR' and
209`--x-libraries=DIR' to specify their locations.
210
211 Some packages offer the ability to configure how verbose the
212execution of `make' will be. For these packages, running `./configure
213--enable-silent-rules' sets the default to minimal output, which can be
214overridden with `make V=1'; while running `./configure
215--disable-silent-rules' sets the default to verbose, which can be
216overridden with `make V=0'.
217
218Particular systems
219==================
220
221 On HP-UX, the default C compiler is not ANSI C compatible. If GNU
222CC is not installed, it is recommended to use the following options in
223order to use an ANSI C compiler:
224
225 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
226
227and if that doesn't work, install pre-built binaries of GCC for HP-UX.
228
229 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
230parse its `<wchar.h>' header file. The option `-nodtk' can be used as
231a workaround. If GNU CC is not installed, it is therefore recommended
232to try
233
234 ./configure CC="cc"
235
236and if that doesn't work, try
237
238 ./configure CC="cc -nodtk"
239
240 On Solaris, don't put `/usr/ucb' early in your `PATH'. This
241directory contains several dysfunctional programs; working variants of
242these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
243in your `PATH', put it _after_ `/usr/bin'.
244
245 On Haiku, software installed for all users goes in `/boot/common',
246not `/usr/local'. It is recommended to use the following options:
247
248 ./configure --prefix=/boot/common
249
250Specifying the System Type
251==========================
252
253 There may be some features `configure' cannot figure out
254automatically, but needs to determine by the type of machine the package
255will run on. Usually, assuming the package is built to be run on the
256_same_ architectures, `configure' can figure that out, but if it prints
257a message saying it cannot guess the machine type, give it the
258`--build=TYPE' option. TYPE can either be a short name for the system
259type, such as `sun4', or a canonical name which has the form:
260
261 CPU-COMPANY-SYSTEM
262
263where SYSTEM can have one of these forms:
264
265 OS
266 KERNEL-OS
267
268 See the file `config.sub' for the possible values of each field. If
269`config.sub' isn't included in this package, then this package doesn't
270need to know the machine type.
271
272 If you are _building_ compiler tools for cross-compiling, you should
273use the option `--target=TYPE' to select the type of system they will
274produce code for.
275
276 If you want to _use_ a cross compiler, that generates code for a
277platform different from the build platform, you should specify the
278"host" platform (i.e., that on which the generated programs will
279eventually be run) with `--host=TYPE'.
280
281Sharing Defaults
282================
283
284 If you want to set default values for `configure' scripts to share,
285you can create a site shell script called `config.site' that gives
286default values for variables like `CC', `cache_file', and `prefix'.
287`configure' looks for `PREFIX/share/config.site' if it exists, then
288`PREFIX/etc/config.site' if it exists. Or, you can set the
289`CONFIG_SITE' environment variable to the location of the site script.
290A warning: not all `configure' scripts look for a site script.
291
292Defining Variables
293==================
294
295 Variables not defined in a site shell script can be set in the
296environment passed to `configure'. However, some packages may run
297configure again during the build, and the customized values of these
298variables may be lost. In order to avoid this problem, you should set
299them in the `configure' command line, using `VAR=value'. For example:
300
301 ./configure CC=/usr/local2/bin/gcc
302
303causes the specified `gcc' to be used as the C compiler (unless it is
304overridden in the site shell script).
305
306Unfortunately, this technique does not work for `CONFIG_SHELL' due to
307an Autoconf bug. Until the bug is fixed you can use this workaround:
308
309 CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
310
311`configure' Invocation
312======================
313
314 `configure' recognizes the following options to control how it
315operates.
316
317`--help'
318`-h'
319 Print a summary of all of the options to `configure', and exit.
320
321`--help=short'
322`--help=recursive'
323 Print a summary of the options unique to this package's
324 `configure', and exit. The `short' variant lists options used
325 only in the top level, while the `recursive' variant lists options
326 also present in any nested packages.
327
328`--version'
329`-V'
330 Print the version of Autoconf used to generate the `configure'
331 script, and exit.
332
333`--cache-file=FILE'
334 Enable the cache: use and save the results of the tests in FILE,
335 traditionally `config.cache'. FILE defaults to `/dev/null' to
336 disable caching.
337
338`--config-cache'
339`-C'
340 Alias for `--cache-file=config.cache'.
341
342`--quiet'
343`--silent'
344`-q'
345 Do not print messages saying which checks are being made. To
346 suppress all normal output, redirect it to `/dev/null' (any error
347 messages will still be shown).
348
349`--srcdir=DIR'
350 Look for the package's source code in directory DIR. Usually
351 `configure' can determine that directory automatically.
352
353`--prefix=DIR'
354 Use DIR as the installation prefix. *note Installation Names::
355 for more details, including other options available for fine-tuning
356 the installation locations.
357
358`--no-create'
359`-n'
360 Run the configure checks, but stop before creating any output
361 files.
362
363`configure' also accepts some other, not widely useful, options. Run
364`configure --help' for more details.
365
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..22c3eb3
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,150 @@
1ACLOCAL_AMFLAGS = -I m4
2
3cython_dist = ethumb/ethumb.c_ethumb.pyx ethumb/ethumb.client.pyx
4
5cython_ins = ethumb/ethumb.c_ethumb.pyx
6cython_outs = ethumb/ethumb.c_ethumb.c
7doc_modules = c_ethumb
8
9if WANT_ETHUMB_CLIENT
10cython_ins += ethumb/ethumb.client.pyx
11cython_outs += ethumb/ethumb.client.c
12doc_modules += client
13endif
14
15CYTHONFLAGS = @CYTHONFLAGS@
16CYTHON_ETHUMB_CLIENT_FLAGS = -I@CYTHON_ETHUMB_CLIENT_INCLUDEDIR@
17EPYDOC = @EPYDOC@
18
19c_ethumb_includes = include/ethumb/c_ethumb.pxd include/ethumb/__init__.py
20c_ethumb_deps =
21c_ethumb_client_includes = include/ethumb/client.pxd
22c_ethumb_client_deps =
23
24examples_files =
25examples_ethumb_client_files = examples/01-simple.py
26
27tests_files =
28tests_ethumb_client_files =
29
30MAINTAINERCLEANFILES = \
31 m4/libtool.m4 \
32 m4/lt~obsolete.m4 \
33 m4/ltoptions.m4 \
34 m4/ltsugar.m4 \
35 m4/ltversion.m4 \
36 m4/libtool.m4 \
37 ltmain.sh \
38 depcomp \
39 aclocal.m4 \
40 config.guess \
41 config.sub \
42 configure \
43 install-sh \
44 Makefile.in \
45 missing \
46 py-compile \
47 config.h.in \
48 $(cython_outs)
49
50EXTRA_DIST = \
51 AUTHORS \
52 COPYING \
53 README \
54 autogen.sh \
55 python-ethumb.pc.in \
56 python-ethumb_client.pc.in \
57 $(cython_dist) $(cython_outs) \
58 $(c_ethumb_includes) \
59 $(c_ethumb_deps) \
60 $(c_ethumb_client_includes) \
61 $(c_ethumb_client_deps) \
62 $(examples_files) \
63 $(examples_ethumb_client_files) \
64 $(tests_files) \
65 $(tests_ethumb_client_files)
66
67# do not distcleancheck for generated ethumb.c_ethumb.[ch]
68distcleancheck_listfiles = \
69 find . -type f \
70 \( -not -name 'ethumb.c_ethumb.c' -a \
71 -not -name 'ethumb.client.c' \)
72
73pkgconfigdir = $(libdir)/pkgconfig
74pkgconfig_DATA = python-ethumb.pc
75
76if HAVE_CYTHON
77BUILT_SOURCES = $(cython_outs)
78$(top_builddir)/ethumb/ethumb.c_ethumb.c $(top_builddir)/ethumb/ethumb.c_ethumb.h: $(top_srcdir)/ethumb/ethumb.c_ethumb.pyx $(c_ethumb_deps) $(c_ethumb_includes) Makefile
79 @$(MKDIR_P) $(top_builddir)/ethumb
80 $(AM_V_GEN)cd $(top_builddir) && $(PYTHON) -m cython -I$(top_srcdir)/include $(CYTHONFLAGS) -o $@ $<
81
82$(top_builddir)/ethumb/ethumb.client.c: $(top_srcdir)/ethumb/ethumb.client.pyx $(c_ethumb_client_deps) $(c_ethumb_client_includes) Makefile
83 @$(MKDIR_P) $(top_builddir)/ethumb
84 $(AM_V_GEN)cd $(top_builddir) && $(PYTHON) -m cython -I$(top_srcdir)/include $(CYTHONFLAGS) -o $@ $<
85
86else
87$(top_builddir)/ethumb/ethumb.c_ethumb.c $(top_builddir)/ethumb/ethumb.client.c: Makefile
88 @echo "NOTE: No cython, using pre-generated ethumb.c_ethumb.[ch]"
89 @$(MKDIR_P) $(top_builddir)/ethumb
90 $(AM_V_GEN)for f in ethumb/ethumb.c_ethumb.c ethumb/ethumb.client.c; do if ! test -f $(top_srcdir)/$$f; then continue; elif ! cmp $(top_srcdir)/$$f $(top_srcdir)/$$f >/dev/null; then cp $(top_srcdir)/$$f $(top_builddir)/$$f; fi; done
91endif
92
93AM_CPPFLAGS = \
94 -I$(top_srcdir) \
95 -I$(top_srcdir)/ethumb \
96 -I$(top_srcdir)/include \
97 @PYTHON_INCLUDES@ \
98 @ETHUMB_CFLAGS@ \
99 @ETHUMB_CLIENT_CFLAGS@
100
101pyexecethumbdir = $(pyexecdir)/ethumb
102pyexecethumb_LTLIBRARIES = c_ethumb.la
103c_ethumb_la_LIBADD = @ETHUMB_LIBS@
104c_ethumb_la_LDFLAGS = -module -avoid-version
105c_ethumb_la_LIBTOOLFLAGS = --tag=disable-static
106c_ethumb_la_SOURCES = \
107 $(top_builddir)/ethumb/ethumb.c_ethumb.c
108
109pyethumbdir = $(pythondir)/ethumb
110pyethumb_PYTHON = ethumb/__init__.py
111
112if WANT_ETHUMB_CLIENT
113pyexecethumbclientdir = $(pyexecdir)/ethumb/
114pyexecethumbclient_LTLIBRARIES = client.la
115client_la_LIBADD = @ETHUMB_CLIENT_LIBS@
116client_la_LDFLAGS = -module -avoid-version
117client_la_LIBTOOLFLAGS = --tag=disable-static
118client_la_SOURCES = $(top_builddir)/ethumb/ethumb.client.c
119
120pkgconfig_DATA += python-ethumb_client.pc
121endif
122
123
124if WANT_EXAMPLES
125examplesdir = $(pkgdatadir)/examples
126examples_DATA = $(examples_files)
127
128if WANT_ETHUMB_CLIENT
129examplesethumbclientdir = $(pkgdatadir)/examples/ethumb-client
130examplesethumbclient_DATA = $(examples_ethumb_client_files)
131endif
132endif
133
134
135.PHONY: doc doc-clean
136if HAVE_EPYDOC
137clean-local: doc-clean
138doc-clean:
139 rm -fr doc/api/html
140doc: $(pkgpyexec_LTLIBRARIES) $(pkgpython_PYTHON)
141 $(AM_V_GEN)PYTHONPATH="$$PWD:$$PWD/.libs:$$PYTHONPATH" \
142 $(EPYDOC) --html -o doc/api/html \
143 -n "@PACKAGE@ @VERSION@ API" \
144 $(doc_modules)
145else
146doc-clean:
147 @echo "Install epydoc then run ./configure again"
148doc:
149 @echo "Install epydoc then run ./configure again"
150endif
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
index 9fe0e28..938e11b 100644
--- a/README
+++ b/README
@@ -7,34 +7,32 @@ REQUIREMENTS
7 * Evas >= 1.0.0 (indirect, Ethumb dependency) 7 * Evas >= 1.0.0 (indirect, Ethumb dependency)
8 * Ecore >= 1.0.0 (indirect, Ethumb dependency) 8 * Ecore >= 1.0.0 (indirect, Ethumb dependency)
9 * E_Dbus >= 1.0.0 (indirect, Ethumb dependency if client is compiled) 9 * E_Dbus >= 1.0.0 (indirect, Ethumb dependency if client is compiled)
10 * Cython >= 0.12.1 10 * Cython >= 0.13
11 * Python-Evas 11 * Python-Evas
12 * Python >= 2.4 12 * Python >= 2.4
13 * Python-setuptools >= 0.6_rc9
14 13
15 14
16BUILDING AND INSTALLING 15BUILDING AND INSTALLING
17======================= 16=======================
18 17
19This package uses setuptools, so execute: 18This package uses automake, so execute:
20 19
21Build:: 20Build::
22 21
23 python setup.py build 22 ./configure --prefix=/usr
23 make all
24 24
25Install:: 25Install::
26 26
27 python setup.py install 27 make install
28 28
29You can choose where to install by using command options, see output 29If you wish to install at alternative locations, then make sure to
30of "python setup.py <command> --help", example: 30configure your PYTHONPATH to be able to access this location!
31 31
32 python setup.py install --help 32If you have Cython dependencies that are installed in alternative
33locations and want Cython to find them, please specify CYTHONFLAGS
34variable to ./configure.
33 35
34Options can also be set in file "setup.cfg". 36The discovery of dependencies is done with pkg-config, thus all your
35 37packages must be properly accessible with such tool. Ensure your
36Ethumb is both a library to generate thumbnails and a client-server 38PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR (cross-compiles) are configured!
37pair to make this process non-blocking and easy to use. In order to
38disable client use the following environment variable:
39
40 * ETHUMB_BUILD_CLIENT=0
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..8610825
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3autoreconf -f -i
4
5if [ -z "$NOCONFIGURE" ]; then
6 ./configure "$@"
7fi
diff --git a/build.sh b/build.sh
deleted file mode 100755
index cb6138e..0000000
--- a/build.sh
+++ /dev/null
@@ -1,105 +0,0 @@
1#!/bin/sh
2
3PYX_FILES="ethumb/ethumb.c_ethumb.pyx ethumb/ethumb.client.pyx"
4
5usage() {
6 cat <<EOF
7Usage:
8
9 $0 <options>
10
11where options:
12
13 --force force rebuild of whole tree, will not trust cython
14 dependency checking.
15 --system install to /usr
16 --home install to $HOME/usr
17 --prefix=XXX install to XXX
18
19EOF
20}
21
22die() {
23 echo "ERROR: $*"
24 exit 1
25}
26
27PREFIX=""
28for arg in $@; do
29 case $arg in
30 --force)
31 touch $PYX_FILES
32 ;;
33 --system)
34 PREFIX="/usr"
35 ;;
36 --home)
37 PREFIX="$HOME/usr"
38 ;;
39 --help)
40 usage
41 exit 0
42 ;;
43 --prefix=*)
44 PREFIX=`echo "$arg" | cut -d= -f2`
45 ;;
46 *)
47 die "unknown option $arg"
48 ;;
49 esac
50done
51
52if [ -z "$PREFIX" ]; then
53 if [ ! -z "$PYTHONPATH" ] && \
54 echo "$PYTHONPATH" | tr ':' '\n' | grep -e "^$HOME/usr" >/dev/null 2>/dev/null; then
55 PREFIX="$HOME/usr"
56 else
57 PREFIX="/usr"
58 fi
59
60 echo "INFO: no --system, --home or explicit prefix given, using $PREFIX"
61fi
62
63PYINCDIR=`python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc(prefix='$PREFIX')"`
64PYLIBDIR=`python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(prefix='$PREFIX')"`
65
66if ! python -c "import sys; sys.exit([-1, 0][('$PYLIBDIR' in sys.path)])"; then
67 die "library dir $PYLIBDIR not in \$PYTHONPATH or any known sys.path"
68fi
69if [ ! -d "$PREFIX" ]; then
70 die "prefix $PREFIX is not a directory"
71fi
72if ! touch "$PREFIX" 2>/dev/null; then
73 die "no permission to write to $PREFIX. needs sudo?"
74fi
75if [ ! -d "PYINCDIR" ] && ! mkdir -p $PYINCDIR 2>/dev/null; then
76 die "could not create $PYINCDIR"
77fi
78if [ ! -d "PYLIBDIR" ] && ! mkdir -p $PYLIBDIR 2>/dev/null; then
79 die "could not create $PYLIBDIR"
80fi
81if ! which cython >/dev/null; then
82 die "cython is not installed"
83fi
84
85if [ -z "$TMPDIR" ]; then
86 TMPDIR="/tmp"
87fi
88DNAME=`dirname $0`
89if [ "$DNAME" = "." ]; then
90 DNAME="$PWD"
91fi
92PRJ=`basename $DNAME`
93LOG="$TMPDIR/$PRJ"
94LOG_OUT="$LOG.out"
95LOG_ERR="$LOG.err"
96
97echo ""
98echo "install: $PRJ prefix=$PREFIX"
99python setup.py build_ext --include-dirs="$PYINCDIR" develop --prefix="$PREFIX" install_headers --install-dir="$PYINCDIR" >"$LOG_OUT" 2>"$LOG_ERR"
100if [ $? -eq 0 ]; then
101 echo "successfully installed, see $LOG_OUT and $LOG_ERR"
102else
103 echo "failed to install, see $LOG_OUT and $LOG_ERR"
104fi
105
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..2082069
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,180 @@
1##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
2##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
3m4_define([v_maj], [0])
4m4_define([v_min], [7])
5m4_define([v_mic], [2])
6m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
7m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
8##-- When released, remove the dnl on the below line
9dnl m4_undefine([v_rev])
10##-- When doing snapshots - change soname. remove dnl on below line
11m4_define([relname], [ver-pre-svn-07])
12m4_define([v_rel], [-release relname])
13##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
14m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])],
15[m4_define([v_ver], [v_maj.v_min.v_mic])])
16m4_define([lt_rev], m4_eval(v_maj + v_min))
17m4_define([lt_cur], v_mic)
18m4_define([lt_age], v_min)
19##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
20##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
21
22AC_INIT([python-ethumb], [v_ver], [enlightenment-devel@lists.sourceforge.net])
23AC_PREREQ([2.52])
24AC_CONFIG_SRCDIR([configure.ac])
25AC_CONFIG_MACRO_DIR([m4])
26AC_CANONICAL_BUILD
27AC_CANONICAL_HOST
28AC_ISC_POSIX
29
30AM_INIT_AUTOMAKE([1.6 dist-bzip2])
31m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
32
33AC_LIBTOOL_WIN32_DLL
34define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
35define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
36AC_PROG_LIBTOOL
37
38##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
39##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
40m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
41m4_ifdef([v_rel], , [m4_define([v_rel], [])])
42AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
43AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
44AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
45AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
46version_info="lt_rev:lt_cur:lt_age"
47release_info="v_rel"
48AC_SUBST(version_info)
49AC_SUBST(release_info)
50##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
51##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
52VMAJ=v_maj
53AC_SUBST(VMAJ)
54
55AC_PROG_CC
56
57PKG_PROG_PKG_CONFIG
58if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
59 pkgconfig_requires_private="Requires.private"
60else
61 pkgconfig_requires_private="Requires"
62fi
63AC_SUBST(pkgconfig_requires_private)
64
65pkgconfig_ethumb_requires_libs="ethumb >= 0.1.0"
66AC_SUBST(pkgconfig_ethumb_requires_libs)
67PKG_CHECK_MODULES([ETHUMB], [$pkgconfig_ethumb_requires_libs])
68wanted_cython_files="${srcdir}/ethumb/ethumb.c_ethumb.pyx"
69
70have_ethumb_client="no"
71want_ethumb_client="auto"
72pkgconfig_ethumb_client_requires_libs="ethumb_client >= 0.1.0"
73AC_SUBST(pkgconfig_ethumb_client_requires_libs)
74AC_ARG_ENABLE([ethumb-client],
75 [AC_HELP_STRING([--disable-ethumb-client],
76 [disable ethumb-client support. @<:@default=detect@:>@])],
77 [want_ethumb_client=$enableval], [])
78
79if test "x$want_ethumb_client" != "xno"; then
80 PKG_CHECK_MODULES([ETHUMB_CLIENT],
81 [$pkgconfig_ethumb_client_requires_libs],
82 [have_ethumb_client="yes"], [have_ethumb_client="no"]
83 )
84else
85 have_ethumb_client="no"
86fi
87if test "x$want_ethumb_client" = "xyes" -a "x$have_ethumb_client" = "xno"; then
88 AC_MSG_ERROR([ethumb-client support requested, but not found by pkg-config: $pkgconfig_ethumb_client_requires_libs])
89fi
90if test "x$want_ethumb_client" != "xno" -a "x${have_ethumb_client}" = "xyes"; then
91 wanted_cython_files="${wanted_cython_files} ${srcdir}/ethumb/ethumb.client.pyx"
92fi
93AM_CONDITIONAL(WANT_ETHUMB_CLIENT,
94 [test "x$want_ethumb_client" != "xno" -a "x${have_ethumb_client}" = "xyes"])
95
96AM_PATH_PYTHON(2.5)
97AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
98
99cython_required_version=0.13
100AM_CHECK_CYTHON([$cython_required_version], [:], [:])
101
102have_cython_precompiled=no
103AM_CHECK_CYTHON_PRECOMPILED([$wanted_cython_files],
104 [have_cython_precompiled=yes], [have_cython_precompiled=no])
105if test "x$CYTHON_FOUND" != "xyes"; then
106 if test v_rev -ne 0; then
107 if test "x$have_cython_precompiled" = "xyes"; then
108 AC_MSG_WARN([Cannot find Cython>=${cython_required_version}, however found a pre-generated file. YOU MAY FIND PROBLEMS, USE A RELEASE TARBALL OR INSTALL CYTHON>=${cython_required_version}])
109 else
110 AC_MSG_ERROR([Cannot find Cython>=${cython_required_version}, and not a release build])
111 fi
112 else
113 if test "x$have_cython_precompiled" = "xyes"; then
114 AC_MSG_NOTICE([Using pre-generated files from release tarball. Install Cython>=${cython_required_version} if you want to re-generate them.])
115 else
116 AC_MSG_ERROR([PACKAGING ERROR RELEASE BUILD WITHOUT PRE-GENERATED FILES])
117 fi
118 fi
119fi
120AM_CONDITIONAL(HAVE_CYTHON, [test "x$CYTHON_FOUND" = "xyes"])
121
122AC_PATH_PROG([EPYDOC], [epydoc], [no])
123AC_SUBST(EPYDOC)
124AM_CONDITIONAL(HAVE_EPYDOC, [test "x$EPYDOC" != "xno"])
125
126AC_ARG_ENABLE([examples],
127 [AC_HELP_STRING([--disable-examples], [Do not install examples])],
128 [if test "x${enableval}" != "xno"; then
129 want_examples=yes
130 else
131 want_examples=no
132 fi
133 ], [want_examples=yes])
134AM_CONDITIONAL([WANT_EXAMPLES], [test "x${want_examples}" != "xno"])
135
136AC_OUTPUT([
137Makefile
138python-ethumb.pc
139python-ethumb_client.pc
140])
141
142if test "x$CYTHON_FOUND" = "xyes"; then
143 cython_info="$CYTHON_VERSION (CYTHONFLAGS=$CYTHONFLAGS)"
144else
145 cython_info="no"
146fi
147AC_SUBST(CYTHONFLAGS)
148
149echo
150echo
151echo
152echo "------------------------------------------------------------------------"
153echo "$PACKAGE $VERSION"
154echo "------------------------------------------------------------------------"
155echo
156echo "Configuration Options Summary:"
157echo
158echo " Python...............: $PYTHON ($PYTHON_VERSION)"
159echo " Cython...............: $cython_info"
160echo
161echo "Compilation............: make (or gmake)"
162echo " CPPFLAGS.............: $CPPFLAGS"
163echo " CFLAGS...............: $CFLAGS"
164echo " LDFLAGS..............: $LDFLAGS"
165echo " PYTHONPATH...........: $PYTHONPATH"
166echo
167echo "Modules:"
168echo " Client...............: ${want_ethumb_client} (found: ${have_ethumb_client})"
169echo
170echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
171echo " prefix...............: $prefix"
172echo
173echo
174echo "To use the local version (as opposed to the installed version) use:"
175echo
176echo " export PYTHONPATH=\"$PWD:$PWD/.libs:\$PYTHONPATH\""
177echo " python -c 'import ethumb; print ethumb' # test load"
178echo
179
180
diff --git a/ez_setup.py b/ez_setup.py
deleted file mode 100644
index 2f5a226..0000000
--- a/ez_setup.py
+++ /dev/null
@@ -1,272 +0,0 @@
1#!python
2"""Bootstrap setuptools installation
3
4If you want to use setuptools in your package's setup.py, just include this
5file in the same directory with it, and add this to the top of your setup.py::
6
7 from ez_setup import use_setuptools
8 use_setuptools()
9
10If you want to require a specific version of setuptools, set a download
11mirror, or use an alternate download directory, you can do so by supplying
12the appropriate options to ``use_setuptools()``.
13
14This file can also be run as a script to install or upgrade setuptools.
15"""
16import sys
17DEFAULT_VERSION = "0.6c9"
18DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
19
20md5_data = {
21 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
22 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
23 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
24 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
25 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
26 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
27 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
28 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
29 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
30 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
31 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
32 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
33 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
34 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
35 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
36 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
37 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
38 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
39 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
40 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
41 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
42 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
43 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
44 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
45 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
46 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
47 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
48 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
49 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
50 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
51}
52
53import sys, os
54try: from hashlib import md5
55except ImportError: from md5 import md5
56
57def _validate_md5(egg_name, data):
58 if egg_name in md5_data:
59 digest = md5(data).hexdigest()
60 if digest != md5_data[egg_name]:
61 print >>sys.stderr, (
62 "md5 validation of %s failed! (Possible download problem?)"
63 % egg_name
64 )
65 sys.exit(2)
66 return data
67
68def use_setuptools(
69 version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
70 download_delay=15
71):
72 """Automatically find/download setuptools and make it available on sys.path
73
74 `version` should be a valid setuptools version number that is available
75 as an egg for download under the `download_base` URL (which should end with
76 a '/'). `to_dir` is the directory where setuptools will be downloaded, if
77 it is not already available. If `download_delay` is specified, it should
78 be the number of seconds that will be paused before initiating a download,
79 should one be required. If an older version of setuptools is installed,
80 this routine will print a message to ``sys.stderr`` and raise SystemExit in
81 an attempt to abort the calling script.
82 """
83 was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
84 def do_download():
85 egg = download_setuptools(version, download_base, to_dir, download_delay)
86 sys.path.insert(0, egg)
87 import setuptools; setuptools.bootstrap_install_from = egg
88 try:
89 import pkg_resources
90 except ImportError:
91 return do_download()
92 try:
93 pkg_resources.require("setuptools>="+version); return
94 except pkg_resources.VersionConflict, e:
95 if was_imported:
96 print >>sys.stderr, (
97 "The required version of setuptools (>=%s) is not available, and\n"
98 "can't be installed while this script is running. Please install\n"
99 " a more recent version first, using 'easy_install -U setuptools'."
100 "\n\n(Currently using %r)"
101 ) % (version, e.args[0])
102 sys.exit(2)
103 else:
104 del pkg_resources, sys.modules['pkg_resources'] # reload ok
105 return do_download()
106 except pkg_resources.DistributionNotFound:
107 return do_download()
108
109def download_setuptools(
110 version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
111 delay = 15
112):
113 """Download setuptools from a specified location and return its filename
114
115 `version` should be a valid setuptools version number that is available
116 as an egg for download under the `download_base` URL (which should end
117 with a '/'). `to_dir` is the directory where the egg will be downloaded.
118 `delay` is the number of seconds to pause before an actual download attempt.
119 """
120 import urllib2, shutil
121 egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
122 url = download_base + egg_name
123 saveto = os.path.join(to_dir, egg_name)
124 src = dst = None
125 if not os.path.exists(saveto): # Avoid repeated downloads
126 try:
127 from distutils import log
128 if delay:
129 log.warn("""
130---------------------------------------------------------------------------
131This script requires setuptools version %s to run (even to display
132help). I will attempt to download it for you (from
133%s), but
134you may need to enable firewall access for this script first.
135I will start the download in %d seconds.
136
137(Note: if this machine does not have network access, please obtain the file
138
139 %s
140
141and place it in this directory before rerunning this script.)
142---------------------------------------------------------------------------""",
143 version, download_base, delay, url
144 ); from time import sleep; sleep(delay)
145 log.warn("Downloading %s", url)
146 src = urllib2.urlopen(url)
147 # Read/write all in one block, so we don't create a corrupt file
148 # if the download is interrupted.
149 data = _validate_md5(egg_name, src.read())
150 dst = open(saveto,"wb"); dst.write(data)
151 finally:
152 if src: src.close()
153 if dst: dst.close()
154 return os.path.realpath(saveto)
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191def main(argv, version=DEFAULT_VERSION):
192 """Install or upgrade setuptools and EasyInstall"""
193 try:
194 import setuptools
195 except ImportError:
196 egg = None
197 try:
198 egg = download_setuptools(version, delay=0)
199 sys.path.insert(0,egg)
200 from setuptools.command.easy_install import main
201 return main(list(argv)+[egg]) # we're done here
202 finally:
203 if egg and os.path.exists(egg):
204 os.unlink(egg)
205 else:
206 if setuptools.__version__ == '0.0.1':
207 print >>sys.stderr, (
208 "You have an obsolete version of setuptools installed. Please\n"
209 "remove it from your system entirely before rerunning this script."
210 )
211 sys.exit(2)
212
213 req = "setuptools>="+version
214 import pkg_resources
215 try:
216 pkg_resources.require(req)
217 except pkg_resources.VersionConflict:
218 try:
219 from setuptools.command.easy_install import main
220 except ImportError:
221 from easy_install import main
222 main(list(argv)+[download_setuptools(delay=0)])
223 sys.exit(0) # try to force an exit
224 else:
225 if argv:
226 from setuptools.command.easy_install import main
227 main(argv)
228 else:
229 print "Setuptools version",version,"or greater has been installed."
230 print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
231
232def update_md5(filenames):
233 """Update our built-in md5 registry"""
234
235 import re
236
237 for name in filenames:
238 base = os.path.basename(name)
239 f = open(name,'rb')
240 md5_data[base] = md5(f.read()).hexdigest()
241 f.close()
242
243 data = [" %r: %r,\n" % it for it in md5_data.items()]
244 data.sort()
245 repl = "".join(data)
246
247 import inspect
248 srcfile = inspect.getsourcefile(sys.modules[__name__])
249 f = open(srcfile, 'rb'); src = f.read(); f.close()
250
251 match = re.search("\nmd5_data = {\n([^}]+)}", src)
252 if not match:
253 print >>sys.stderr, "Internal error!"
254 sys.exit(2)
255
256 src = src[:match.start(1)] + repl + src[match.end(1):]
257 f = open(srcfile,'w')
258 f.write(src)
259 f.close()
260
261
262if __name__=='__main__':
263 if len(sys.argv)>2 and sys.argv[1]=='--md5update':
264 update_md5(sys.argv[2:])
265 else:
266 main(sys.argv[1:])
267
268
269
270
271
272
diff --git a/m4/cython.m4 b/m4/cython.m4
new file mode 100644
index 0000000..ba1d432
--- /dev/null
+++ b/m4/cython.m4
@@ -0,0 +1,77 @@
1dnl AM_CHECK_CYTHON([VERSION [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
2dnl Check if a Cython version is installed
3dnl Defines CYTHON_VERSION and CYTHON_FOUND
4AC_DEFUN([AM_CHECK_CYTHON],
5[
6AC_REQUIRE([AM_PATH_PYTHON])
7ifelse([$1], [], [_msg=""], [_msg=" >= $1"])
8AC_MSG_CHECKING(for Cython$_msg)
9AC_CACHE_VAL(py_cv_cython, [
10
11prog="import Cython.Compiler.Version; print Cython.Compiler.Version.version"
12CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC`
13
14py_cv_cython=no
15if test "x$CYTHON_VERSION" != "x"; then
16 py_cv_cython=yes
17fi
18
19if test "x$py_cv_cython" = "xyes"; then
20 ifelse([$1], [], [:],
21 AS_VERSION_COMPARE([$CYTHON_VERSION], [$1], [py_cv_cython=no]))
22fi
23])
24
25AC_MSG_RESULT([$py_cv_cython])
26
27if test "x$py_cv_cython" = "xyes"; then
28 CYTHON_FOUND=yes
29 ifelse([$2], [], [:], [$2])
30else
31 CYTHON_FOUND=no
32 ifelse([$3], [], [AC_MSG_ERROR([Could not find usable Cython$_msg])], [$3])
33fi
34])
35
36dnl AM_CHECK_CYTHON_PRECOMPILED(FILE-LIST [, ACTION-IF-ALL [, ACTION-IF-NOT-ALL]])
37dnl given a list of files ending in .pyx (FILE-LIST), check if their .c
38dnl counterpart exists and is not older than the source.
39dnl ACTION-IF-ALL is called only if no files failed the check and thus
40dnl all pre-generated files are usable.
41dnl ACTION-IF-NOT-ALL is called if some or all failed. If not provided,
42dnl an error will be issued.
43AC_DEFUN([AM_CHECK_CYTHON_PRECOMPILED],
44[
45_to_check_list="$1"
46_failed_list=""
47_exists_list=""
48
49for inf in $_to_check_list; do
50 outf=`echo "$inf" | sed -e 's/^\(.*\)[.]pyx$/\1.c/'`
51 if test "$outf" = "$inf"; then
52 AC_MSG_WARN([File to check must end in .pyx, but got: $inf -- Skip])
53 continue
54 fi
55
56 AC_MSG_CHECKING([for pre-generated $outf for $inf])
57 if ! test -f "$outf"; then
58 _res=no
59 _failed_list="${_failed_list} $outf"
60 elif ! test "$outf" -nt "$inf"; then
61 _res="no (older)"
62 _failed_list="${_failed_list} $outf"
63 else
64 _res=yes
65 _exists_list="${_exists_list} $outf"
66 fi
67 AC_MSG_RESULT($_res)
68done
69
70if test -z "$_failed_list" -a -n "$_exists_list"; then
71 ifelse([$2], [], [:], [$2])
72else
73 ifelse([$3], [],
74 [AC_MSG_ERROR([Missing pre-generated files: $_failed_list])],
75 [$3])
76fi
77])
diff --git a/m4/python.m4 b/m4/python.m4
new file mode 100644
index 0000000..3dd1aa6
--- /dev/null
+++ b/m4/python.m4
@@ -0,0 +1,67 @@
1dnl code from pygtk-2.16.0
2## this one is commonly used with AM_PATH_PYTHONDIR ...
3dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
4dnl Check if a module containing a given symbol is visible to python.
5AC_DEFUN([AM_CHECK_PYMOD],
6[AC_REQUIRE([AM_PATH_PYTHON])
7py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
8AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
9AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
10ifelse([$2],[], [prog="
11import sys
12try:
13 import $1
14except ImportError:
15 sys.exit(1)
16except:
17 sys.exit(0)
18sys.exit(0)"], [prog="
19import $1
20$1.$2"])
21if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
22 then
23 eval "py_cv_mod_$py_mod_var=yes"
24 else
25 eval "py_cv_mod_$py_mod_var=no"
26 fi
27])
28py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
29if test "x$py_val" != xno; then
30 AC_MSG_RESULT(yes)
31 ifelse([$3], [],, [$3
32])dnl
33else
34 AC_MSG_RESULT(no)
35 ifelse([$4], [],, [$4
36])dnl
37fi
38])
39
40dnl a macro to check for ability to create python extensions
41dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
42dnl function also defines PYTHON_INCLUDES
43AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
44[AC_REQUIRE([AM_PATH_PYTHON])
45AC_MSG_CHECKING(for headers required to compile python extensions)
46dnl deduce PYTHON_INCLUDES
47py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
48py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
49if test -x "$PYTHON-config"; then
50PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
51else
52PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
53if test "$py_prefix" != "$py_exec_prefix"; then
54 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
55fi
56fi
57AC_SUBST(PYTHON_INCLUDES)
58dnl check if the headers exist:
59save_CPPFLAGS="$CPPFLAGS"
60CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
61AC_TRY_CPP([#include <Python.h>],dnl
62[AC_MSG_RESULT(found)
63$1],dnl
64[AC_MSG_RESULT(not found)
65$2])
66CPPFLAGS="$save_CPPFLAGS"
67])
diff --git a/python-ethumb.pc.in b/python-ethumb.pc.in
new file mode 100644
index 0000000..963f471
--- /dev/null
+++ b/python-ethumb.pc.in
@@ -0,0 +1,10 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4datarootdir=@datarootdir@
5datadir=@datarootdir@/@PACKAGE@
6
7Name: @PACKAGE@
8Description: Python bindings for Ethumb
9@pkgconfig_requires_private@: @pkgconfig_ethumb_requires_libs@
10Version: @VERSION@
diff --git a/python-ethumb_client.pc.in b/python-ethumb_client.pc.in
new file mode 100644
index 0000000..576131f
--- /dev/null
+++ b/python-ethumb_client.pc.in
@@ -0,0 +1,10 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4datarootdir=@datarootdir@
5datadir=@datarootdir@/python-ecore-evas
6
7Name: Python Ethumb Client
8Description: Python bindings for Ethumb Client
9@pkgconfig_requires_private@: @pkgconfig_ethumb_client_requires_libs@
10Version: @VERSION@
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 8626e22..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
1[install]
2optimize=1
3
4[build_rpm]
5requires=ethumb >= 0.1.0
6build_requires=ethumb >= 0.1.0
7group=System Environment/Libraries
8release=1
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 07f1a63..0000000
--- a/setup.py
+++ /dev/null
@@ -1,135 +0,0 @@
1import sys
2import os
3
4try:
5 from Cython.Distutils import build_ext
6 # work around stupid setuptools that insists on just checking pyrex
7 sys.modules['Pyrex'] = sys.modules['Cython']
8 have_cython = True
9except ImportError:
10 have_cython = False
11
12if not have_cython and not os.path.exists("ethumb/ethumb.c_ethumb.c"):
13 raise SystemExit("You need Cython -- http://cython.org/")
14
15from ez_setup import use_setuptools
16use_setuptools('0.6c9')
17
18if not have_cython:
19 print "No cython installed, using existing generated C files."
20 from setuptools.command.build_ext import build_ext
21
22from setuptools import setup, find_packages, Extension
23import subprocess
24import shlex
25
26def getstatusoutput(cmdline):
27 cmd = shlex.split(cmdline)
28 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
29 out, err = p.communicate()
30 return p.returncode, out
31
32
33def pkgconfig(*packages, **kw):
34 flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries',
35 '-D': 'prepro_vars'}
36 pkgs = ' '.join(packages)
37 cmdline = 'pkg-config --libs --cflags %s' % pkgs
38
39 status, output = getstatusoutput(cmdline)
40 if status != 0:
41 raise ValueError("could not find pkg-config module: %s" % pkgs)
42
43 for token in output.split():
44 flag = flag_map.get(token[:2], None)
45 if flag is not None:
46 kw.setdefault(flag, []).append(token[2:])
47 elif token.startswith("-Wl,"):
48 kw.setdefault("extra_link_args", []).append(token)
49 else:
50 kw.setdefault("extra_compile_args", []).append(token)
51
52 if "extra_link_args" in kw:
53 print "Using extra_link_args: %s" % " ".join(kw["extra_link_args"])
54 if "extra_compile_args" in kw:
55 print "Using extra_compile_args: %s" % " ".join(kw["extra_compile_args"])
56
57 return kw
58
59
60ethumbmodule = Extension('ethumb.c_ethumb',
61 sources=['ethumb/ethumb.c_ethumb.pyx',
62 ],
63 depends=['include/ethumb/c_ethumb.pxd',
64 ],
65 **pkgconfig('"ethumb >= 0.1.0"'))
66
67
68trove_classifiers = [
69 "Development Status :: 3 - Alpha",
70 "Environment :: Console :: Framebuffer",
71 "Environment :: X11 Applications",
72 "Intended Audience :: Developers",
73 "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
74 "Operating System :: MacOS :: MacOS X",
75 "Operating System :: POSIX",
76 "Programming Language :: C",
77 "Programming Language :: Python",
78 "Topic :: Software Development :: Libraries :: Python Modules",
79 "Topic :: Software Development :: User Interfaces",
80 ]
81
82
83long_description = """\
84Python bindings for Ethumb, part of Enlightenment Foundation Libraries.
85
86Ethumb is a small, display independent, and quick thumbnailing library.
87
88The lib itself conforms to the standard put forth by freedesktop.org You
89can find out more information about it at
90http://triq.net/~jens/thumbnail-spec/index.html. It seemed better to
91break it out into a component that only depended on what was absolutely
92necessary.
93
94Ethumb uses Evas to create thumbnails.
95"""
96
97
98class ethumb_build_ext(build_ext):
99 def finalize_options(self):
100 build_ext.finalize_options(self)
101 self.include_dirs.insert(0, 'include')
102 if hasattr(self, "pyrex_include_dirs"):
103 self.pyrex_include_dirs.extend(self.include_dirs)
104
105
106module_list = [ethumbmodule]
107
108if int(os.environ.get("ETHUMB_BUILD_CLIENT", 1)):
109 ethumbclientmodule = Extension(
110 'ethumb.client',
111 sources=['ethumb/ethumb.client.pyx'],
112 depends=['include/ethumb/c_ethumb.pxd',
113 'include/ethumb/client.pxd',
114 ],
115 **pkgconfig('"ethumb >= 0.1.0" "ethumb_client >= 0.1.0"'))
116 module_list.append(ethumbclientmodule)
117else:
118 print "NOTICE: not building ethumb.client module as requested " \
119 "by ETHUMB_BUILD_CLIENT=0!"
120
121setup(name='python-ethumb',
122 version='0.6.0',
123 license='LGPL',
124 author='Rafael Antognolli',
125 author_email='antognolli@profusion.mobi',
126 url='http://www.enlightenment.org/',
127 description='Python bindings for Ethumb',
128 long_description=long_description,
129 keywords='wrapper binding enlightenment graphics jpg jpeg png thumbnail freedesktop.org',
130 classifiers=trove_classifiers,
131 packages=find_packages(),
132 ext_modules=module_list,
133 zip_safe=False,
134 cmdclass={'build_ext': ethumb_build_ext,},
135 )