[fiona] 10/12: Add patch to not copy gdalapi files in clean target.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sun Feb 7 22:37:34 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository fiona.

commit 18f9a3ad90893c4f1f332353a279e044c642fffb
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Feb 7 23:02:19 2016 +0100

    Add patch to not copy gdalapi files in clean target.
---
 debian/patches/0007-clean.patch | 122 ++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |   1 +
 2 files changed, 123 insertions(+)

diff --git a/debian/patches/0007-clean.patch b/debian/patches/0007-clean.patch
new file mode 100644
index 0000000..f219fb8
--- /dev/null
+++ b/debian/patches/0007-clean.patch
@@ -0,0 +1,122 @@
+Description: Don't copy gdalapi files in clean target.
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: https://github.com/Toblerity/Fiona/pull/322
+
+--- a/setup.py
++++ b/setup.py
+@@ -77,7 +77,7 @@ def copy_gdalapi(gdalversion):
+         shutil.copy('fiona/ogrext2.pyx', 'fiona/ogrext.pyx')
+         shutil.copy('fiona/ograpi2.pxd', 'fiona/ograpi.pxd')
+  
+-if '--gdalversion' in sys.argv:
++if '--gdalversion' in sys.argv and "clean" not in sys.argv:
+     index = sys.argv.index('--gdalversion')
+     sys.argv.pop(index)
+     gdalversion = sys.argv.pop(index)
+@@ -91,57 +91,58 @@ libraries = []
+ extra_link_args = []
+ gdal_output = [None] * 4
+ 
+-try:
+-    gdal_config = os.environ.get('GDAL_CONFIG', 'gdal-config')
+-    for i, flag in enumerate(("--cflags", "--libs", "--datadir", "--version")):
+-        gdal_output[i] = check_output([gdal_config, flag]).strip()
+-
+-    for item in gdal_output[0].split():
+-        if item.startswith("-I"):
+-            include_dirs.extend(item[2:].split(":"))
+-    for item in gdal_output[1].split():
+-        if item.startswith("-L"):
+-            library_dirs.extend(item[2:].split(":"))
+-        elif item.startswith("-l"):
+-            libraries.append(item[2:])
++if "clean" not in sys.argv:
++    try:
++        gdal_config = os.environ.get('GDAL_CONFIG', 'gdal-config')
++        for i, flag in enumerate(("--cflags", "--libs", "--datadir", "--version")):
++            gdal_output[i] = check_output([gdal_config, flag]).strip()
++
++        for item in gdal_output[0].split():
++            if item.startswith("-I"):
++                include_dirs.extend(item[2:].split(":"))
++        for item in gdal_output[1].split():
++            if item.startswith("-L"):
++                library_dirs.extend(item[2:].split(":"))
++            elif item.startswith("-l"):
++                libraries.append(item[2:])
++            else:
++                # e.g. -framework GDAL
++                extra_link_args.append(item)
++
++        copy_gdalapi(gdal_output[3])
++
++    except Exception as e:
++        if os.name == "nt":
++            log.info(("Building on Windows requires extra options to setup.py to locate needed GDAL files.\n"
++                       "More information is available in the README."))
+         else:
+-            # e.g. -framework GDAL
+-            extra_link_args.append(item)
++            log.warning("Failed to get options via gdal-config: %s", str(e))
+ 
+-    copy_gdalapi(gdal_output[3])
+-
+-except Exception as e:
+-    if os.name == "nt":
+-        log.info(("Building on Windows requires extra options to setup.py to locate needed GDAL files.\n"
+-                   "More information is available in the README."))
+-    else:
+-        log.warning("Failed to get options via gdal-config: %s", str(e))
+-
+-    # Conditionally copy the GDAL data. To be used in conjunction with
+-    # the bdist_wheel command to make self-contained binary wheels.
++        # Conditionally copy the GDAL data. To be used in conjunction with
++        # the bdist_wheel command to make self-contained binary wheels.
++        if os.environ.get('PACKAGE_DATA'):
++            try:
++                shutil.rmtree('fiona/gdal_data')
++            except OSError:
++                pass
++            shutil.copytree(datadir, 'fiona/gdal_data')
+     if os.environ.get('PACKAGE_DATA'):
+-        try:
+-            shutil.rmtree('fiona/gdal_data')
+-        except OSError:
+-            pass
+-        shutil.copytree(datadir, 'fiona/gdal_data')
+-if os.environ.get('PACKAGE_DATA'):
+-    destdir = 'fiona/gdal_data'
+-    if gdal_output[2]:
+-        log.info("Copying gdal data from %s" % gdal_output[2])
+-        copy_data_tree(gdal_output[2], destdir)
+-    else:
+-        # check to see if GDAL_DATA is defined
+-        gdal_data = os.environ.get('GDAL_DATA', None)
+-        if gdal_data:
+-            log.info("Copying gdal data from %s" % gdal_data)
+-            copy_data_tree(gdal_data, destdir)
+-
+-    # Conditionally copy PROJ.4 data. 
+-    projdatadir = os.environ.get('PROJ_LIB', '/usr/local/share/proj')
+-    if os.path.exists(projdatadir):
+-        log.info("Copying proj data from %s" % projdatadir)
+-        copy_data_tree(projdatadir, 'fiona/proj_data')
++        destdir = 'fiona/gdal_data'
++        if gdal_output[2]:
++            log.info("Copying gdal data from %s" % gdal_output[2])
++            copy_data_tree(gdal_output[2], destdir)
++        else:
++            # check to see if GDAL_DATA is defined
++            gdal_data = os.environ.get('GDAL_DATA', None)
++            if gdal_data:
++                log.info("Copying gdal data from %s" % gdal_data)
++                copy_data_tree(gdal_data, destdir)
++
++        # Conditionally copy PROJ.4 data. 
++        projdatadir = os.environ.get('PROJ_LIB', '/usr/local/share/proj')
++        if os.path.exists(projdatadir):
++            log.info("Copying proj data from %s" % projdatadir)
++            copy_data_tree(projdatadir, 'fiona/proj_data')
+ 
+ ext_options = dict(
+     include_dirs=include_dirs,
diff --git a/debian/patches/series b/debian/patches/series
index 8b5b0ac..3795660 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0004-Just-use-int-as-a-plain-old-builtin.patch
 0005-Initial-attempt-at-fiona.remove-for-deleting-data-sources.patch
 0006-Remove-unknown-distribution-options.patch
+0007-clean.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/fiona.git



More information about the Pkg-grass-devel mailing list