[Git][debian-gis-team/python-cartopy][master] 4 commits: Fix "ModuleNotFoundError: No module named 'cartopy._version'".

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Tue Dec 7 13:27:51 GMT 2021



Bas Couwenberg pushed to branch master at Debian GIS Project / python-cartopy


Commits:
bf4c4a51 by Bas Couwenberg at 2021-12-07T13:06:54+01:00
Fix "ModuleNotFoundError: No module named 'cartopy._version'".

Revert "Simplify the version file generation"

This reverts commit ff830aab972771b9320d1275cdc667a57f2cdfc3.

Revert "Strip repack suffix form upstream version"

This reverts commit cccc61bc484021d348bab76a83420431b9fafca2.

Revert "New 0004-Set-version-in-setup.cfg.patch"

This reverts commit 2620ae37e211d330da9c4123a88a751d261658b4.

- - - - -
ff0d6a65 by Bas Couwenberg at 2021-12-07T14:10:38+01:00
Revert "Also ignore test failures on ppc64el."

This reverts commit 2bf81324949aeb36ae8ddefb900ca6282fc98d8c.

- - - - -
a5d4d590 by Bas Couwenberg at 2021-12-07T14:10:59+01:00
Explicitly use Agg matplotlib backend.

- - - - -
ae425bd5 by Bas Couwenberg at 2021-12-07T14:19:39+01:00
Set distribution to unstable.

- - - - -


5 changed files:

- debian/changelog
- − debian/patches/0004-Set-version-in-setup.cfg.patch
- debian/patches/series
- debian/rules
- + debian/version.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,10 +1,13 @@
-python-cartopy (0.20.1+dfsg-2) UNRELEASED; urgency=medium
+python-cartopy (0.20.1+dfsg-2) unstable; urgency=medium
+
+  * Team upload.
 
   [ Bas Couwenberg ]
   * Drop test_crs.patch, no longer required.
   * Add python3-all to test depends.
     (closes: #999101)
-  * Also ignore test failures on mips64el & ppc64el.
+  * Also ignore test failures on mips64el.
+  * Explicitly use Agg matplotlib backend.
 
   [ Antonio Valentino ]
   * Update d/copyright file.
@@ -17,13 +20,10 @@ python-cartopy (0.20.1+dfsg-2) UNRELEASED; urgency=medium
     - add item for no-manual-page usr/bin/cartopy_feature_download.py.
   * debian/rules:
     - rename scripts in usr/bin to remove the language extension.
-  * debian/rules:
-    - simplify the version file generation.
   * debian/patches:
     - refresh and renumber all patches
-    - new 0004-Set-version-in-setup.cfg.patch.
 
- -- Bas Couwenberg <sebastic at debian.org>  Fri, 22 Oct 2021 08:58:49 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Tue, 07 Dec 2021 14:19:15 +0100
 
 python-cartopy (0.20.1+dfsg-1) unstable; urgency=medium
 


=====================================
debian/patches/0004-Set-version-in-setup.cfg.patch deleted
=====================================
@@ -1,20 +0,0 @@
-From: Antonio Valentino <antonio.valentino at tiscali.it>
-Date: Sat, 4 Dec 2021 18:24:02 +0000
-Subject: Set version in setup.cfg
-
-Forwarded: not-needed
----
- setup.cfg | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/setup.cfg b/setup.cfg
-index 3e9cec0..31183c2 100644
---- a/setup.cfg
-+++ b/setup.cfg
-@@ -7,3 +7,6 @@ exclude = \
-     build, \
-     setup.py, \
-     docs/source/conf.py
-+
-+[metadata]
-+version = attr: cartopy._version.version


=====================================
debian/patches/series
=====================================
@@ -1,4 +1,3 @@
 0001-Skip-tests-failing-on-i386-architectures.patch
 0002-test_robinson.patch
 0003-test_gridliner.patch
-0004-Set-version-in-setup.cfg.patch


=====================================
debian/rules
=====================================
@@ -3,14 +3,13 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE = 1
 
-include /usr/share/dpkg/pkg-info.mk
-UPSTREAM_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
-
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 # Workaround for proj_api.h deprecation in PROJ 6.0.0
 export DEB_CFLAGS_MAINT_APPEND=-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H
 
+export MPLBACKEND=Agg
+
 export PYBUILD_NAME = cartopy
 export PYBUILD_INSTALL_ARGS = --install-data=/usr/share/cartopy
 export PYBUILD_TEST_PYTEST = 1
@@ -32,12 +31,13 @@ override_dh_auto_clean:
 	$(RM) -r __pycache__
 
 override_dh_auto_configure:
-	echo "version = '$(UPSTREAM_VERSION)'" > $(CURDIR)/lib/cartopy/_version.py
+	python3 $(CURDIR)/debian/version.py
+
 	dh_auto_configure
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-ifneq (,$(filter $(DEB_BUILD_ARCH),mips64el s390x ppc64el ppc64))
+ifneq (,$(filter $(DEB_BUILD_ARCH),mips64el s390x ppc64))
 	xvfb-run -a -n 1 -s "-screen 0 1280x1024x24 -dpi 96" dh_auto_test || echo "Ignoring test failures"
 else
 	xvfb-run -a -n 1 -s "-screen 0 1280x1024x24 -dpi 96" dh_auto_test


=====================================
debian/version.py
=====================================
@@ -0,0 +1,92 @@
+#!/usr/bin/python3
+
+import os
+import re
+import subprocess
+import sys
+
+
+version = None
+
+var = 'DEB_VERSION_UPSTREAM'
+
+if var in os.environ:
+    version = os.environ[var]
+else:
+    changelog_file = os.path.join(
+        os.path.dirname(__file__),
+        'changelog',
+    )
+
+    cmd = [
+        'dpkg-parsechangelog',
+        '-S', 'Version',
+        '-l', changelog_file,
+    ]
+
+    p = subprocess.Popen(
+        cmd,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+    )
+
+    (stdout, stderr) = p.communicate()
+
+    if p.returncode != 0:
+        print("Error: Command failed: %s (%s)" % (
+            " ".join(cmd),
+            p.returncode
+        ))
+        if stdout:
+            print(stdout.decode())
+        if stderr:
+            print(stderr.decode())
+        sys.exit(p.returncode)
+
+    version = stdout.decode()
+
+    # Strip package revision
+    version = re.sub(
+        r'-[^-]*$',
+        '',
+        version,
+    )
+
+    # Strip epoch
+    version = re.sub(
+        r'^[0-9]*:',
+        '',
+        version,
+    )
+
+# Strip repacksuffix
+version = re.sub(
+    r'\+.*$',
+    '',
+    version,
+)
+
+# Strip pre-release identifier
+version = re.sub(
+    r'~',
+    '',
+    version,
+)
+
+version_file = os.path.join(
+    os.path.dirname(
+        os.path.dirname(__file__),
+    ),
+    'lib',
+    'cartopy',
+    '_version.py',
+)
+
+with open(version_file, 'w') as f:
+    f.write("# Generated by %s/%s\n" % (
+        os.path.basename(
+            os.path.dirname(__file__),
+        ),
+        os.path.basename(__file__)
+    ))
+    f.write("version = '%s'\n" % version)



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-cartopy/-/compare/23297c35d57abaead53c11ee62da4aa49db8ad99...ae425bd543bb0f323f0aad2164f3df8a0e4d2e99

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-cartopy/-/compare/23297c35d57abaead53c11ee62da4aa49db8ad99...ae425bd543bb0f323f0aad2164f3df8a0e4d2e99
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20211207/41946ce3/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list