chiark / gitweb /
buildserver: use py3's pathlib to generate cache file URL
authorHans-Christoph Steiner <hans@eds.org>
Mon, 26 Sep 2016 11:17:31 +0000 (07:17 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 28 Sep 2016 07:52:49 +0000 (09:52 +0200)
This should handle edge cases better, like odd characters in the path, etc.

makebuildserver

index 398cd30596d4b1f2f9ed4bd1d61802ced35c536d..69eea7b67fdd793349470fda784f3fa7ab7c8af3 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import os
+import pathlib
 import requests
 import stat
 import sys
@@ -52,9 +53,8 @@ options, args = parser.parse_args()
 cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver')
 config = {
     'basebox': 'jessie64',
-    # TODO in py3, convert this to pathlib.Path(absolute_path_string).as_uri()
     'baseboxurl': [
-        'file://' + os.path.join(cachedir, 'jessie64.box'),
+        pathlib.Path(os.path.join(cachedir, 'jessie64.box')).as_uri(),
         'https://f-droid.org/jessie64.box',
     ],
     'debian_mirror': 'http://http.debian.net/debian/',