diff options
author | Kacper Kowalik <xarthisius@gentoo.org> | 2012-01-06 17:37:02 +0000 |
---|---|---|
committer | Kacper Kowalik <xarthisius@gentoo.org> | 2012-01-06 17:37:02 +0000 |
commit | 9d18b40823f4557e8bbeb1e3c69a5abd50e4e8f5 (patch) | |
tree | 30ca9c49a720b3cec8552e786c6a823a9c66d2fe /dev-python | |
parent | dev-java/netbeans-mobility: version bump (diff) | |
download | gentoo-2-9d18b40823f4557e8bbeb1e3c69a5abd50e4e8f5.tar.gz gentoo-2-9d18b40823f4557e8bbeb1e3c69a5abd50e4e8f5.tar.bz2 gentoo-2-9d18b40823f4557e8bbeb1e3c69a5abd50e4e8f5.zip |
Version bump, adds Python3 support
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'dev-python')
-rw-r--r-- | dev-python/pywcs/ChangeLog | 10 | ||||
-rw-r--r-- | dev-python/pywcs/files/pywcs-1.11-wcslib.patch | 126 | ||||
-rw-r--r-- | dev-python/pywcs/pywcs-1.11.ebuild | 46 |
3 files changed, 180 insertions, 2 deletions
diff --git a/dev-python/pywcs/ChangeLog b/dev-python/pywcs/ChangeLog index 6b818e2e0721..98fe406284aa 100644 --- a/dev-python/pywcs/ChangeLog +++ b/dev-python/pywcs/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-python/pywcs -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/pywcs/ChangeLog,v 1.2 2011/08/04 18:42:19 bicatali Exp $ +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pywcs/ChangeLog,v 1.3 2012/01/06 17:37:02 xarthisius Exp $ + +*pywcs-1.11 (06 Jan 2012) + + 06 Jan 2012; Kacper Kowalik <xarthisius@gentoo.org> + +files/pywcs-1.11-wcslib.patch, +pywcs-1.11.ebuild: + Version bump, adds Python3 support 04 Aug 2011; Sébastien Fabbro <bicatali@gentoo.org> metadata.xml: Switched herd to sci-astronomy diff --git a/dev-python/pywcs/files/pywcs-1.11-wcslib.patch b/dev-python/pywcs/files/pywcs-1.11-wcslib.patch new file mode 100644 index 000000000000..2dd198677307 --- /dev/null +++ b/dev-python/pywcs/files/pywcs-1.11-wcslib.patch @@ -0,0 +1,126 @@ +--- defsetup.py ++++ defsetup.py +@@ -78,73 +78,27 @@ + + ###################################################################### + # WCSLIB +-WCSVERSION = "4.8.2" +-WCSLIB = "wcslib" # Path to wcslib +-WCSLIB_PATCHED = "wcslib" +-WCSLIBC = join(WCSLIB_PATCHED, "C") # Path to wcslib source files +-WCSFILES = [ # List of wcslib files to compile +- 'flexed/wcsbth.c', +- 'flexed/wcspih.c', +- 'flexed/wcsulex.c', +- 'flexed/wcsutrn.c', +- 'cel.c', +- 'lin.c', +- 'log.c', +- 'prj.c', +- 'spc.c', +- 'sph.c', +- 'spx.c', +- 'tab.c', +- 'wcs.c', +- 'wcserr.c', +- 'wcsfix.c', +- 'wcshdr.c', +- 'wcsprintf.c', +- 'wcsunits.c', +- 'wcsutil.c'] +-WCSFILES = [join(WCSLIBC, x) for x in WCSFILES] ++from subprocess import Popen, PIPE ++from re import match + +-###################################################################### +-# WCSLIB CONFIGURATION +- +-# The only configuration parameter needed at compile-time is how to +-# specify a 64-bit signed integer. Python's ctypes module can get us +-# that information, but it is only available in Python 2.5 or later. +-# If we can't be absolutely certain, we default to "long long int", +-# which is correct on most platforms (x86, x86_64). If we find +-# platforms where this heuristic doesn't work, we may need to hardcode +-# for them. +-def determine_64_bit_int(): +- try: +- try: +- import ctypes +- except ImportError: +- raise ValueError() +- +- if ctypes.sizeof(ctypes.c_longlong) == 8: +- return "long long int" +- elif ctypes.sizeof(ctypes.c_long) == 8: +- return "long int" +- elif ctypes.sizeof(ctypes.c_int) == 8: +- return "int" +- else: +- raise ValueError() +- +- except ValueError: +- return "long long int" ++def pkgconfig(*packages, **kw): ++ flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'} ++ arg = "--libs --cflags --modversion %s" % ' '.join(packages) ++ for tok in Popen(["pkg-config "+ arg],stdout=PIPE, shell=True).communicate()[0].split(): ++ token = tok.decode("utf-8") ++ if(match("[0-9]",token)): ++ kw.setdefault("version",[]).append(token) ++ else: ++ kw.setdefault(flag_map.get(token[:2]), []).append(token[2:]) ++ return kw + +-h_file = StringIO() +-h_file.write(""" +-/* WCSLIB library version number. */ +-#define WCSLIB_VERSION %s +- +-/* 64-bit integer data type. */ +-#define WCSLIB_INT64 %s +-""" % (WCSVERSION, determine_64_bit_int())) +-write_if_different(join(srcroot, 'src', 'wcsconfig.h'), h_file.getvalue()) ++WCSLIB = pkgconfig('wcslib') ++WCSVERSION = WCSLIB['version'][0] + + ###################################################################### + # GENERATE DOCSTRINGS IN C ++ ++###################################################################### + docstrings = {} + with open(join(srcroot, 'doc', 'docstrings.py'), 'rb') as fd: + docstrings_content = fd.read() +@@ -233,7 +186,8 @@ + + ###################################################################### + # DISTUTILS SETUP +-libraries = [] ++libraries = WCSLIB['libraries'] ++include_dirs = [numpy_include, join(srcroot, "src")] + WCSLIB['include_dirs'] + define_macros = [('ECHO', None), + ('WCSTRIG_MACRO', None), + ('PYWCS_BUILD', None), +@@ -282,13 +236,8 @@ + + PYWCS_EXTENSIONS = [ + Extension('pywcs._pywcs', +- WCSFILES + PYWCS_SOURCES, +- include_dirs = +- [numpy_include, +- join(srcroot, WCSLIBC), +- WCSLIBC, +- join(srcroot, "src") +- ], ++ PYWCS_SOURCES, ++ include_dirs=include_dirs, + define_macros=define_macros, + undef_macros=undef_macros, + extra_compile_args=extra_compile_args, +@@ -309,7 +258,6 @@ + 'ext_modules' : PYWCS_EXTENSIONS, + 'data_files' : [ + ( 'pywcs/include', ['src/*.h']), +- ( 'pywcs/include/wcslib', [ WCSLIBC + '/*.h'] ), + ( 'pywcs/tests/maps', ['lib/pywcs/tests/maps/*.hdr']), + ( 'pywcs/tests/spectra', ['lib/pywcs/tests/spectra/*.hdr']), + ( 'pywcs/tests/data', ['lib/pywcs/tests/data/*.hdr']) diff --git a/dev-python/pywcs/pywcs-1.11.ebuild b/dev-python/pywcs/pywcs-1.11.ebuild new file mode 100644 index 000000000000..9d354b05a1ee --- /dev/null +++ b/dev-python/pywcs/pywcs-1.11.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pywcs/pywcs-1.11.ebuild,v 1.1 2012/01/06 17:37:02 xarthisius Exp $ + +EAPI=4 + +PYTHON_DEPEND="*" +SUPPORT_PYTHON_ABIS="1" + +inherit distutils eutils + +WCS_V=4.8.2 +MYP=${P}-${WCS_V} + +DESCRIPTION="Python routines for handling the FITS World Coordinate System" +HOMEPAGE="https://trac6.assembla.com/astrolib/wiki http://www.scipy.org/AstroLib" +SRC_URI="http://stsdas.stsci.edu/astrolib/${MYP}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +CDEPEND=">=sci-astronomy/wcslib-${WCS_V}" +DEPEND="${CDEPEND} + dev-util/pkgconfig" +RDEPEND="${CDEPEND} + dev-python/pyfits" + +S=${WORKDIR}/${MYP} + +src_prepare(){ + epatch "${FILESDIR}"/${P}-wcslib.patch + distutils_src_prepare +} + +src_test() { + testing() { + PYTHONPATH="$(ls -d build-${PYTHON_ABI}/lib.*)" \ + "$(PYTHON)" lib/${PN}/tests/test.py + } + python_execute_function testing +} + +#FIX: compiles twice (once during build, another time during install) +# seems to be in the defsetup.py hack script |