--- setup.py.orig 2013-01-11 16:46:43.000000000 +0100
+++ setup.py 2013-08-19 14:50:23.110124644 +0200
@@ -101,23 +101,33 @@
if zlib_incdir is None and zlib_dir is not None:
incdirs.append(os.path.join(zlib_dir,'include'))
-g2clib_deps = glob.glob('g2clib_src/*.c')
-g2clib_deps.append('g2clib.c')
-incdirs.append("g2clib_src")
+#g2clib_deps = glob.glob('g2clib_src/*.c')
+#g2clib_deps.append('g2clib.c')
+g2clib_deps = ['g2clib.c',]
+g2clib_dir = '/usr/lib64'
+g2clib_incdir = '/usr/include'
+libdirs.append(g2clib_dir)
+incdirs.append(g2clib_incdir)
+libraries.append('grib2c')
+#incdirs.append("g2clib_src")
macros=[]
-# if jasper or openjpeg lib not available...
-if 'jasper' not in libraries and 'openjpeg' not in libraries:
- g2clib_deps.remove('g2clib_src/jpcpack.c')
- g2clib_deps.remove('g2clib_src/jpcunpack.c')
-else:
- macros.append(('USE_JPEG2000',1))
-# if png lib not available...
-if 'png' not in libraries:
- g2clib_deps.remove('g2clib_src/pngpack.c')
- g2clib_deps.remove('g2clib_src/pngunpack.c')
-else:
- macros.append(('USE_PNG',1))
+# the USE_JPEG2000 and USE_PNG defines are only used inside
+# g2clib_src, which is removed before doing the fedora rpm build
+# anyway, so these lines can be safely discarded:
+
+## if jasper or openjpeg lib not available...
+#if 'jasper' not in libraries and 'openjpeg' not in libraries:
+# g2clib_deps.remove('g2clib_src/jpcpack.c')
+# g2clib_deps.remove('g2clib_src/jpcunpack.c')
+#else:
+# macros.append(('USE_JPEG2000',1))
+## if png lib not available...
+#if 'png' not in libraries:
+# g2clib_deps.remove('g2clib_src/pngpack.c')
+# g2clib_deps.remove('g2clib_src/pngunpack.c')
+#else:
+# macros.append(('USE_PNG',1))
if hasattr(sys,'maxsize'):
if sys.maxsize > 2**31-1: macros.append(('__64BIT__',1))
@@ -130,6 +140,11 @@
pygribext =\
Extension("pygrib",["pygrib.c"],include_dirs=incdirs,library_dirs=libdirs,libraries=libraries)
+# don't provide the scripts for the python3 version, to prevent collisions
+# in case a user installs both a python2 and a python3 version of the module
+scripts_list = []
+if sys.version_info[0] < 3:
+ scripts_list = ['utils/grib_list','utils/grib_repack','utils/cnvgrib1to2','utils/cnvgrib2to1']
setup(name = "pygrib",
version = "1.9.6",
@@ -138,7 +153,6 @@
author_email = "jeffrey.s.whitaker@noaa.gov",
url = "http://code.google.com/p/pygrib",
download_url = "http://code.google.com/p/pygrib/downloads/list",
- scripts =
- ['utils/grib_list','utils/grib_repack','utils/cnvgrib1to2','utils/cnvgrib2to1'],
+ scripts = scripts_list,
ext_modules = [pygribext,g2clibext,redtoregext],
py_modules = ["ncepgrib2"])