← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/txpkgupload:py38 into txpkgupload:master

 

Colin Watson has proposed merging ~cjwatson/txpkgupload:py38 into txpkgupload:master.

Commit message:
Add Python 3.8 support

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/txpkgupload/+git/txpkgupload/+merge/430024

Some parts of this are a bit hacky, but it should be enough to get us to the point where this won't break on upgrade to focal.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/txpkgupload:py38 into txpkgupload:master.
diff --git a/Makefile b/Makefile
index dc8d75b..cf21735 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ $(VERSION_INFO):
 
 
 check: | $(DEPENDENCY_DIR)
-	tox
+	tox -e py35
 
 
 dist:
diff --git a/requirements.txt b/requirements.txt
index 5a6dd8d..ab7562f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,7 +8,6 @@ cffi==1.14.3
 constantly==15.1.0
 cryptography==3.0
 distro==1.4.0
-enum34==1.1.6
 extras==1.0.0
 fixtures==3.0.0
 FormEncode==1.3.1
diff --git a/setup.py b/setup.py
index f64b98a..246ba61 100755
--- a/setup.py
+++ b/setup.py
@@ -50,6 +50,7 @@ setup(
     description=description,
     long_description=generate('src/txpkgupload/NEWS.txt'),
     license='AGPL v3',
+    python_requires=">=3.5",
     install_requires=[
         'FormEncode',
         'importlib-metadata; python_version < "3.8"',
@@ -73,8 +74,11 @@ setup(
         "License :: OSI Approved :: GNU Affero General Public License v3",
         "Operating System :: OS Independent",
         "Programming Language :: Python",
-        "Programming Language :: Python :: 2",
         "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.5",
+        "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
         ],
     extras_require=dict(
         test=['fixtures',
diff --git a/src/txpkgupload/NEWS.txt b/src/txpkgupload/NEWS.txt
index 9dcd759..c1fa967 100644
--- a/src/txpkgupload/NEWS.txt
+++ b/src/txpkgupload/NEWS.txt
@@ -2,6 +2,14 @@
 NEWS for txpkgupload
 ====================
 
+0.5
+===
+
+- Drop Python 2 support.
+- Adjust directory creation to work around a change in ``os.makedirs`` in
+  Python 3.7.
+- Add Python 3.8 support.
+
 0.4 (2021-01-04)
 ================
 
diff --git a/src/txpkgupload/filesystem.py b/src/txpkgupload/filesystem.py
index 495bd7b..a598184 100644
--- a/src/txpkgupload/filesystem.py
+++ b/src/txpkgupload/filesystem.py
@@ -150,9 +150,9 @@ class UploadFileSystem:
                 raise OSError("Directory already exists:", path)
             raise OSError("OOPS, can't create:", path)
         else:
-            old_mask = os.umask(0)
+            old_mask = os.umask(0o002)
             try:
-                os.makedirs(full_path, 0o775)
+                os.makedirs(full_path)
             finally:
                 os.umask(old_mask)
 
@@ -213,9 +213,9 @@ class UploadFileSystem:
             dirname = os.path.dirname(full_path)
             if dirname:
                 if not os.path.exists(dirname):
-                    old_mask = os.umask(0)
+                    old_mask = os.umask(0o002)
                     try:
-                        os.makedirs(dirname, 0o775)
+                        os.makedirs(dirname)
                     finally:
                         os.umask(old_mask)
 
diff --git a/src/txpkgupload/plugin.py b/src/txpkgupload/plugin.py
index 0168643..9cf30ec 100644
--- a/src/txpkgupload/plugin.py
+++ b/src/txpkgupload/plugin.py
@@ -231,7 +231,11 @@ class PkgUploadServiceMaker:
             temp_dir = os.path.abspath(os.path.join(
                 root, os.pardir, "tmp-incoming"))
         if not os.path.exists(temp_dir):
-            os.makedirs(temp_dir, 0o775)
+            old_mask = os.umask(0o002)
+            try:
+                os.makedirs(temp_dir)
+            finally:
+                os.umask(old_mask)
 
         ftp_config = config["ftp"]
         ftp_service = FTPServiceFactory.makeFTPService(
diff --git a/tox.ini b/tox.ini
index e03defd..85035bc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,8 +1,14 @@
 [tox]
 envlist =
     py35
+    py38
+skip_missing_interpreters = true
 
 [testenv]
+setenv =
+    py38: VIRTUALENV_PIP = 9.0.1
+    py38: VIRTUALENV_SETUPTOOLS = 44.1.1
+    py38: VIRTUALENV_WHEEL = 0.35.1
 install_command =
     python -m pip install --no-index --find-links file://{toxinidir}/download-cache/ {opts} {packages}
 commands =