aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/pywcs/files/pywcs-1.8.1-wcslib.patch')
-rw-r--r--dev-python/pywcs/files/pywcs-1.8.1-wcslib.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/dev-python/pywcs/files/pywcs-1.8.1-wcslib.patch b/dev-python/pywcs/files/pywcs-1.8.1-wcslib.patch
new file mode 100644
index 000000000..16d790bcd
--- /dev/null
+++ b/dev-python/pywcs/files/pywcs-1.8.1-wcslib.patch
@@ -0,0 +1,120 @@
+--- defsetup.py.orig 2010-04-24 11:27:55.655012084 +0200
++++ defsetup.py 2010-04-24 12:00:52.393014990 +0200
+@@ -38,70 +38,26 @@
+
+ ######################################################################
+ # WCSLIB
+-WCSVERSION = "4.4.4"
+-WCSLIB = "wcslib-%s" % WCSVERSION # Path to wcslib
+-WCSLIBC = join(WCSLIB, "C") # Path to wcslib source files
+-WCSFILES = [ # List of wcslib files to compile
+- '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',
+- 'wcsfix.c',
+- 'wcshdr.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()
++def pkgconfig(*packages, **kw):
++ flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
++ arg = "--libs --cflags --modversion %s" % ' '.join(packages)
++ for token in Popen(["pkg-config "+ arg],stdout=PIPE, shell=True).communicate()[0].split():
++ if(match("[0-9]",token)):
++ kw.setdefault("version",[]).append(token)
++ else:
++ kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
++ return kw
+
+- except ValueError:
+- return "long long int"
++WCSLIB = pkgconfig('wcslib')
++WCSVERSION = WCSLIB['version'][0]
+
+ if os.path.exists("pywcs"):
+ srcroot = 'pywcs'
+ else:
+ srcroot = '.'
+-fd = open(join(srcroot, 'src', 'wcsconfig.h'), "w")
+-fd.write("""
+-/* WCSLIB library version number. */
+-#define WCSLIB_VERSION %s
+-
+-/* 64-bit integer data type. */
+-#define WCSLIB_INT64 %s
+-""" % (WCSVERSION, determine_64_bit_int()))
+-fd.close()
+
+ ######################################################################
+ # GENERATE DOCSTRINGS IN C
+@@ -190,7 +146,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),
+@@ -233,13 +190,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,
+@@ -259,7 +211,6 @@
+ 'ext_modules' : PYWCS_EXTENSIONS,
+ 'data_files' : [
+ ( 'pywcs/include', ['src/*.h']),
+- ( 'pywcs/include/wcslib', [ WCSLIBC + '/*.h'] ),
+ ],
+ }
+