[Git][debian-gis-team/osm2pgsql][master] Add patch to use Python 3 for regression-test.py.

Bas Couwenberg gitlab at salsa.debian.org
Sat Jul 27 14:00:08 BST 2019



Bas Couwenberg pushed to branch master at Debian GIS Project / osm2pgsql


Commits:
72f9fd10 by Bas Couwenberg at 2019-07-27T12:07:39Z
Add patch to use Python 3 for regression-test.py.

- - - - -


4 changed files:

- debian/changelog
- debian/control
- + debian/patches/python3.patch
- + debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+osm2pgsql (0.96.0+ds-4) UNRELEASED; urgency=medium
+
+  * Add patch to use Python 3 for regression-test.py.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Sat, 27 Jul 2019 13:47:49 +0200
+
 osm2pgsql (0.96.0+ds-3) unstable; urgency=medium
 
   * Bump Standards-Version to 4.4.0, no changes.


=====================================
debian/control
=====================================
@@ -19,8 +19,8 @@ Build-Depends: debhelper (>= 9),
                zlib1g-dev,
                liblua5.2-dev,
                lua5.2,
-               python,
-               python-psycopg2
+               python3,
+               python3-psycopg2
 Standards-Version: 4.4.0
 Vcs-Browser: https://salsa.debian.org/debian-gis-team/osm2pgsql
 Vcs-Git: https://salsa.debian.org/debian-gis-team/osm2pgsql.git


=====================================
debian/patches/python3.patch
=====================================
@@ -0,0 +1,209 @@
+Description: Use Python 3 for regression-test.py.
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: https://github.com/openstreetmap/osm2pgsql/pull/939
+
+--- a/tests/regression-test.py
++++ b/tests/regression-test.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ import unittest
+ import psycopg2
+@@ -342,14 +342,14 @@ class BaseTestCase(unittest.TestCase):
+             self.conn.autocommit = True
+             self.cur = self.conn.cursor()
+         except Exception as e:
+-            print "I am unable to connect to the database." + e
++            print("I am unable to connect to the database." + e)
+ 
+     def dbClose(self):
+         self.cur.close()
+         self.conn.close()
+ 
+     def executeStatements(self, seq):
+-        print "*********************************"
++        print("*********************************")
+         self.dbConnect()
+         try:
+             for i in seq:
+@@ -418,8 +418,8 @@ class BasicNonSlimTestCase(BaseNonSlimTe
+         self.setUpGeneric(self.parameters, full_import_file)
+ 
+     def runTest(self):
+-        print "****************************************"
+-        print "Running initial import for " + self.name
++        print("****************************************")
++        print("Running initial import for " + self.name)
+         self.executeStatements(self.initialStatements)
+ 
+ 
+@@ -437,10 +437,10 @@ class BasicSlimTestCase(BaseSlimTestCase
+ 
+ 
+     def runTest(self):
+-        print "****************************************"
+-        print "Running initial import for " + self.name
++        print("****************************************")
++        print("Running initial import for " + self.name)
+         self.executeStatements(self.initialStatements)
+-        print "Running diff-import for " + self.name
++        print("Running diff-import for " + self.name)
+         self.updateGeneric(self.parameters, diff_import_file)
+         self.executeStatements(self.postDiffStatements)
+ 
+@@ -458,10 +458,10 @@ class MultipolygonSlimTestCase(BaseSlimT
+ 
+ 
+     def runTest(self):
+-        print "****************************************"
+-        print "Running initial import for " + self.name
++        print("****************************************")
++        print("Running initial import for " + self.name)
+         self.executeStatements(self.initialStatements)
+-        print "Running diff-import for " + self.name
++        print("Running diff-import for " + self.name)
+         self.updateGeneric(self.parameters, diff_multipoly_import_file)
+         self.executeStatements(self.postDiffStatements)
+ 
+@@ -480,10 +480,10 @@ class BasicGazetteerTestCase(BaseGazette
+ 
+ 
+     def runTest(self):
+-        print "****************************************"
+-        print "Running initial import in gazetteer mode for " + self.name
++        print("****************************************")
++        print("Running initial import in gazetteer mode for " + self.name)
+         self.executeStatements(self.initialStatements)
+-        print "Running diff-import in gazetteer mode for " + self.name
++        print("Running diff-import in gazetteer mode for " + self.name)
+         self.updateGeneric(self.parameters, diff_import_file)
+         self.executeStatements(self.postDiffStatements)
+ 
+@@ -508,26 +508,26 @@ def findContribSql(filename):
+ #****************************************************************
+ #****************************************************************
+ def setupDB():
+-    print "Setting up test database"
++    print("Setting up test database")
+     try:
+         gen_conn=psycopg2.connect("dbname='template1'")
+         gen_conn.autocommit = True
+     except Exception as e:
+-        print "I am unable to connect to the database."
++        print("I am unable to connect to the database.")
+         exit(1)
+ 
+     try:
+         gen_cur = gen_conn.cursor()
+     except Exception as e:
+         gen_conn.close()
+-        print "I am unable to connect to the database."
++        print("I am unable to connect to the database.")
+         exit(1)
+ 
+     try:
+         gen_cur.execute("""DROP DATABASE IF EXISTS \"osm2pgsql-test\"""")
+         gen_cur.execute("""CREATE DATABASE \"osm2pgsql-test\" WITH ENCODING 'UTF8'""")
+     except Exception as e:
+-        print "Failed to create osm2pgsql-test db" + e.pgerror
++        print("Failed to create osm2pgsql-test db" + e.pgerror)
+         exit(1);
+     finally:
+         gen_cur.close()
+@@ -537,13 +537,13 @@ def setupDB():
+         test_conn=psycopg2.connect("dbname='osm2pgsql-test'")
+         test_conn.autocommit = True
+     except Exception as e:
+-        print "I am unable to connect to the database." + e
++        print("I am unable to connect to the database." + e)
+         exit(1)
+ 
+     try:
+         test_cur = test_conn.cursor()
+     except Exception as e:
+-        print "I am unable to connect to the database." + e
++        print("I am unable to connect to the database." + e)
+         gen_conn.close()
+         exit(1)
+ 
+@@ -556,15 +556,15 @@ def setupDB():
+ 
+             test_cur.execute("""SELECT spcname FROM pg_tablespace WHERE spcname = 'tablespacetest'""")
+             if test_cur.fetchone():
+-                print "We already have a tablespace, can use that"
++                print("We already have a tablespace, can use that")
+             else:
+-                print "The test needs a temporary tablespace to run in, but it does not exist. Please create the temporary tablespace. On Linux, you can do this by running:"
+-                print "  sudo mkdir -p /tmp/psql-tablespace"
+-                print "  sudo /bin/chown postgres.postgres /tmp/psql-tablespace"
+-                print "  psql -c \"CREATE TABLESPACE tablespacetest LOCATION '/tmp/psql-tablespace'\" postgres"
++                print("The test needs a temporary tablespace to run in, but it does not exist. Please create the temporary tablespace. On Linux, you can do this by running:")
++                print("  sudo mkdir -p /tmp/psql-tablespace")
++                print("  sudo /bin/chown postgres.postgres /tmp/psql-tablespace")
++                print("  psql -c \"CREATE TABLESPACE tablespacetest LOCATION '/tmp/psql-tablespace'\" postgres")
+                 exit(77)
+         except Exception as e:
+-            print "Failed to create directory for tablespace" + str(e)
++            print("Failed to create directory for tablespace" + str(e))
+ 
+         # Check for postgis
+         try:
+@@ -593,13 +593,13 @@ def setupDB():
+         test_conn.close()
+ 
+ def tearDownDB():
+-    print "Cleaning up test database"
++    print("Cleaning up test database")
+     try:
+         gen_conn=psycopg2.connect("dbname='template1'")
+         gen_conn.autocommit = True
+         gen_cur = gen_conn.cursor()
+     except Exception as e:
+-        print "I am unable to connect to the database."
++        print("I am unable to connect to the database.")
+         exit(1)
+ 
+     try:
+@@ -607,7 +607,7 @@ def tearDownDB():
+         if (created_tablespace == 1):
+             gen_cur.execute("""DROP TABLESPACE IF EXISTS \"tablespacetest\"""")
+     except Exception as e:
+-        print "Failed to clean up osm2pgsql-test db" + e.pgerror
++        print("Failed to clean up osm2pgsql-test db" + e.pgerror)
+         exit(1);
+ 
+     gen_cur.close()
+@@ -646,8 +646,8 @@ finally:
+     tearDownDB()
+ 
+ if success:
+-    print "All tests passed :-)"
++    print("All tests passed :-)")
+     exit(0)
+ else:
+-    print "Some tests failed :-("
++    print("Some tests failed :-(")
+     exit(1)
+--- a/CONTRIBUTING.md
++++ b/CONTRIBUTING.md
+@@ -73,7 +73,7 @@ executing ``ctest``.
+ Regression tests require python and psycopg to be installed. On Ubuntu run:
+ 
+ ```sh
+-sudo apt-get install python-psycopg2
++sudo apt-get install python3-psycopg2
+ ```
+ 
+ Most of these tests depend on being able to set up a database and run osm2pgsql
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -68,7 +68,7 @@ if (NOT LUA_FOUND)
+   set_tests_properties(test-output-multi-tags PROPERTIES WILL_FAIL on)
+ endif()
+ 
+-find_package(PythonInterp)
++find_package(PythonInterp 3)
+ 
+ if (PYTHONINTERP_FOUND)
+   add_test(NAME regression-test-pbf COMMAND ${PYTHON_EXECUTABLE} tests/regression-test.py -f tests/liechtenstein-2013-08-03.osm.pbf -x $<TARGET_FILE:osm2pgsql>


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+python3.patch



View it on GitLab: https://salsa.debian.org/debian-gis-team/osm2pgsql/commit/72f9fd102186073309ce221534ea874bdb5f2b2e

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/osm2pgsql/commit/72f9fd102186073309ce221534ea874bdb5f2b2e
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/20190727/7185a52f/attachment-0001.html>


More information about the Pkg-grass-devel mailing list