mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
Remove path workarounds for old python versions
This commit is contained in:
parent
c5ba4bc848
commit
4a581bdfb6
@ -343,8 +343,7 @@ def try_init_submodules(app, last_build, vcs):
|
||||
# Return all directories under startdir that contain any of the manifest
|
||||
# files, and thus are probably an Android project.
|
||||
def dirs_with_manifest(startdir):
|
||||
# TODO: Python3.6: Accepts a path-like object.
|
||||
for root, _dirs, files in os.walk(str(startdir)):
|
||||
for root, _dirs, files in os.walk(startdir):
|
||||
if any(m in files for m in [
|
||||
'AndroidManifest.xml', 'pom.xml', 'build.gradle', 'build.gradle.kts']):
|
||||
yield Path(root)
|
||||
|
@ -950,8 +950,6 @@ def get_head_commit_id(git_repo):
|
||||
def setup_vcs(app):
|
||||
"""Checkout code from VCS and return instance of vcs and the build dir."""
|
||||
build_dir = get_build_dir(app)
|
||||
# TODO: Remove this
|
||||
build_dir = str(build_dir)
|
||||
|
||||
# Set up vcs interface and make sure we have the latest code...
|
||||
logging.debug("Getting {0} vcs interface for {1}"
|
||||
@ -966,8 +964,6 @@ def setup_vcs(app):
|
||||
|
||||
|
||||
def getvcs(vcstype, remote, local):
|
||||
# TODO: Remove this in Python3.6
|
||||
local = str(local)
|
||||
if vcstype == 'git':
|
||||
return vcs_git(remote, local)
|
||||
if vcstype == 'git-svn':
|
||||
@ -995,8 +991,6 @@ class vcs:
|
||||
|
||||
def __init__(self, remote, local):
|
||||
|
||||
# TODO: Remove this in Python3.6
|
||||
local = str(local)
|
||||
# svn, git-svn and bzr may require auth
|
||||
self.username = None
|
||||
if self.repotype() in ('git-svn', 'bzr'):
|
||||
@ -1268,7 +1262,6 @@ class vcs_git(vcs):
|
||||
def latesttags(self):
|
||||
"""Return a list of latest tags."""
|
||||
self.checkrepo()
|
||||
# TODO: Python3.6: Should accept path-like
|
||||
return [tag.name for tag in sorted(
|
||||
git.Repo(self.local).tags,
|
||||
key=lambda t: t.commit.committed_date,
|
||||
@ -1603,29 +1596,25 @@ def retrieve_string_singleline(app_dir, string, xmlfiles=None):
|
||||
|
||||
def manifest_paths(app_dir, flavours):
|
||||
"""Return list of existing files that will be used to find the highest vercode."""
|
||||
# TODO: Remove this in Python3.6
|
||||
app_dir = str(app_dir)
|
||||
possible_manifests = \
|
||||
[os.path.join(app_dir, 'AndroidManifest.xml'),
|
||||
os.path.join(app_dir, 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join(app_dir, 'src', 'AndroidManifest.xml'),
|
||||
os.path.join(app_dir, 'build.gradle'),
|
||||
os.path.join(app_dir, 'build-extras.gradle'),
|
||||
os.path.join(app_dir, 'build.gradle.kts')]
|
||||
[Path(app_dir) / 'AndroidManifest.xml',
|
||||
Path(app_dir) / 'src/main/AndroidManifest.xml',
|
||||
Path(app_dir) / 'src/AndroidManifest.xml',
|
||||
Path(app_dir) / 'build.gradle',
|
||||
Path(app_dir) / 'build-extras.gradle',
|
||||
Path(app_dir) / 'build.gradle.kts']
|
||||
|
||||
for flavour in flavours:
|
||||
if flavour == 'yes':
|
||||
continue
|
||||
possible_manifests.append(
|
||||
os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
|
||||
Path(app_dir) / 'src' / flavour / 'AndroidManifest.xml')
|
||||
|
||||
return [path for path in possible_manifests if os.path.isfile(path)]
|
||||
return [path for path in possible_manifests if path.is_file()]
|
||||
|
||||
|
||||
def fetch_real_name(app_dir, flavours):
|
||||
"""Retrieve the package name. Returns the name, or None if not found."""
|
||||
# TODO: Remove this in Python3.6
|
||||
app_dir = str(app_dir)
|
||||
for path in manifest_paths(app_dir, flavours):
|
||||
if not path.endswith('.xml') or not os.path.isfile(path):
|
||||
continue
|
||||
@ -1736,8 +1725,6 @@ def parse_androidmanifests(paths, app):
|
||||
return None
|
||||
|
||||
for path in paths:
|
||||
# TODO: Remove this in Python3.6
|
||||
path = str(path)
|
||||
if not os.path.isfile(path):
|
||||
continue
|
||||
|
||||
@ -1752,7 +1739,7 @@ def parse_androidmanifests(paths, app):
|
||||
if len(app.get('Builds', [])) > 0 and 'gradle' in app['Builds'][-1] and app['Builds'][-1].gradle:
|
||||
flavours = app['Builds'][-1].gradle
|
||||
|
||||
if path.endswith('.gradle') or path.endswith('.gradle.kts'):
|
||||
if path.suffix == '.gradle' or path.name.endswith('.gradle.kts'):
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
android_plugin_file = False
|
||||
inside_flavour_group = 0
|
||||
@ -2221,11 +2208,11 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||
for path in manifest_paths(root_dir, flavours):
|
||||
if not os.path.isfile(path):
|
||||
continue
|
||||
if path.endswith('.xml'):
|
||||
if path.suffix == '.xml':
|
||||
regsub_file(r'android:versionName="[^"]*"',
|
||||
r'android:versionName="%s"' % build.versionName,
|
||||
path)
|
||||
elif path.endswith('.gradle'):
|
||||
elif path.suffix == '.gradle':
|
||||
regsub_file(r"""(\s*)versionName[\s'"=]+.*""",
|
||||
r"""\1versionName '%s'""" % build.versionName,
|
||||
path)
|
||||
@ -2233,13 +2220,13 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||
if build.forcevercode:
|
||||
logging.info("Changing the version code")
|
||||
for path in manifest_paths(root_dir, flavours):
|
||||
if not os.path.isfile(path):
|
||||
if not path.is_file():
|
||||
continue
|
||||
if path.endswith('.xml'):
|
||||
if path.suffix == '.xml':
|
||||
regsub_file(r'android:versionCode="[^"]*"',
|
||||
r'android:versionCode="%s"' % build.versionCode,
|
||||
path)
|
||||
elif path.endswith('.gradle'):
|
||||
elif path.suffix == '.gradle':
|
||||
regsub_file(r'versionCode[ =]+[0-9]+',
|
||||
r'versionCode %s' % build.versionCode,
|
||||
path)
|
||||
@ -2341,7 +2328,7 @@ def getpaths_map(build_dir, globpaths):
|
||||
p = p.strip()
|
||||
full_path = os.path.join(build_dir, p)
|
||||
full_path = os.path.normpath(full_path)
|
||||
paths[p] = [r[len(build_dir) + 1:] for r in glob.glob(full_path)]
|
||||
paths[p] = [r[len(str(build_dir)) + 1:] for r in glob.glob(full_path)]
|
||||
if not paths[p]:
|
||||
not_found_paths.append(p)
|
||||
if not_found_paths:
|
||||
|
@ -264,8 +264,7 @@ def main():
|
||||
if Path('build.gradle').exists() or Path('build.gradle.kts').exists():
|
||||
build.gradle = ['yes']
|
||||
|
||||
# TODO: Python3.6: Should accept path-like
|
||||
git_repo = git.Repo(str(Path.cwd()))
|
||||
git_repo = git.Repo(Path.cwd())
|
||||
for remote in git.Remote.iter_items(git_repo):
|
||||
if remote.name == 'origin':
|
||||
url = git_repo.remotes.origin.url
|
||||
@ -277,8 +276,7 @@ def main():
|
||||
elif options.url:
|
||||
app = get_app_from_url(options.url)
|
||||
tmp_importer_dir = clone_to_tmp_dir(app)
|
||||
# TODO: Python3.6: Should accept path-like
|
||||
git_repo = git.Repo(str(tmp_importer_dir))
|
||||
git_repo = git.Repo(tmp_importer_dir)
|
||||
|
||||
if not options.omit_disable:
|
||||
build.disable = 'Generated by import.py - check/set version fields and commit id'
|
||||
@ -387,8 +385,7 @@ def main():
|
||||
git_repo.close()
|
||||
except AttributeError: # Debian/stretch's version does not have close()
|
||||
pass
|
||||
# TODO: Python3.9: Accepts a path-like object for both src and dst.
|
||||
shutil.move(str(tmp_importer_dir), str(build_dir))
|
||||
shutil.move(tmp_importer_dir, build_dir)
|
||||
Path('build/.fdroidvcs-' + appid).write_text(app.RepoType + ' ' + app.Repo)
|
||||
|
||||
metadatapath = Path('metadata') / (appid + '.yml')
|
||||
|
@ -752,8 +752,7 @@ def parse_metadata(metadatapath):
|
||||
metadata_in_repo = build_dir / '.fdroid.yml'
|
||||
if metadata_in_repo.is_file():
|
||||
try:
|
||||
# TODO: Python3.6: Should accept path-like
|
||||
commit_id = common.get_head_commit_id(git.Repo(str(build_dir)))
|
||||
commit_id = common.get_head_commit_id(git.Repo(build_dir))
|
||||
logging.debug(_('Including metadata from %s@%s') % (metadata_in_repo, commit_id))
|
||||
except git.exc.InvalidGitRepositoryError:
|
||||
logging.debug(_('Including metadata from {path}').format(metadata_in_repo))
|
||||
|
@ -87,13 +87,12 @@ def main():
|
||||
newbuilds.append(new)
|
||||
app['Builds'] = newbuilds
|
||||
|
||||
# rewrite to temporary file before overwriting existsing
|
||||
# rewrite to temporary file before overwriting existing
|
||||
# file in case there's a bug in write_metadata
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp_path = Path(tmpdir) / path.name
|
||||
metadata.write_metadata(tmp_path, app)
|
||||
# TODO: Python3.6: Accept path-lik
|
||||
shutil.move(str(tmp_path), str(path))
|
||||
shutil.move(tmp_path, path)
|
||||
|
||||
logging.debug(_("Finished"))
|
||||
|
||||
|
@ -27,8 +27,7 @@ class CheckupdatesTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
self.basedir = localmodule / 'tests'
|
||||
# TODO: Python3.6: Accepts a path-like object.
|
||||
os.chdir(str(self.basedir))
|
||||
os.chdir(self.basedir)
|
||||
|
||||
def test_autoupdatemode_no_suffix(self):
|
||||
fdroidserver.checkupdates.options = mock.Mock()
|
||||
|
@ -1075,7 +1075,7 @@ class CommonTest(unittest.TestCase):
|
||||
self.assertEqual('b30bb971af0d134866e158ec748fcd553df97c150f58b0a963190bbafbeb0868', sig)
|
||||
|
||||
def test_parse_xml(self):
|
||||
manifest = os.path.join('source-files', 'fdroid', 'fdroidclient', 'AndroidManifest.xml')
|
||||
manifest = Path('source-files/fdroid/fdroidclient/AndroidManifest.xml')
|
||||
parsed = fdroidserver.common.parse_xml(manifest)
|
||||
self.assertIsNotNone(parsed)
|
||||
self.assertEqual(str(type(parsed)), "<class 'xml.etree.ElementTree.Element'>")
|
||||
@ -1084,8 +1084,8 @@ class CommonTest(unittest.TestCase):
|
||||
app = fdroidserver.metadata.App()
|
||||
app.id = 'org.fdroid.fdroid'
|
||||
paths = [
|
||||
os.path.join('source-files', 'fdroid', 'fdroidclient', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'fdroid', 'fdroidclient', 'build.gradle'),
|
||||
Path('source-files/fdroid/fdroidclient/AndroidManifest.xml'),
|
||||
Path('source-files/fdroid/fdroidclient/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1099,17 +1099,17 @@ class CommonTest(unittest.TestCase):
|
||||
app.SourceCode = url.rstrip('.git')
|
||||
app.Repo = url
|
||||
paths = [
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'avenginekit', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'client', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'client', 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'emojilibrary', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'gradle', 'build_libraries.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'imagepicker', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'mars-core-release', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'push', 'build.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'settings.gradle'),
|
||||
os.path.join('source-files', 'cn.wildfirechat.chat', 'chat', 'build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/avenginekit/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/client/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/client/src/main/AndroidManifest.xml'),
|
||||
Path('source-files/cn.wildfirechat.chat/emojilibrary/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/gradle/build_libraries.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/imagepicker/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/mars-core-release/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/push/build.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/settings.gradle'),
|
||||
Path('source-files/cn.wildfirechat.chat/chat/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1119,18 +1119,18 @@ class CommonTest(unittest.TestCase):
|
||||
app = fdroidserver.metadata.App()
|
||||
app.Repo = 'https://github.com/Integreight/1Sheeld-Android-App'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'pagerIndicator', 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'pagerIndicator', 'build.gradle'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'oneSheeld', 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'oneSheeld', 'build.gradle'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'localeapi', 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'localeapi', 'build.gradle'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'build.gradle'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'settings.gradle'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'quickReturnHeader', 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'quickReturnHeader', 'build.gradle'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'pullToRefreshlibrary', 'src', 'main', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'com.integreight.onesheeld', 'pullToRefreshlibrary', 'build.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/pagerIndicator/src/main/AndroidManifest.xml'),
|
||||
Path('source-files/com.integreight.onesheeld/pagerIndicator/build.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/oneSheeld/src/main/AndroidManifest.xml'),
|
||||
Path('source-files/com.integreight.onesheeld/oneSheeld/build.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/localeapi/src/main/AndroidManifest.xml'),
|
||||
Path('source-files/com.integreight.onesheeld/localeapi/build.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/build.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/settings.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/quickReturnHeader/src/main/AndroidManifest.xml'),
|
||||
Path('source-files/com.integreight.onesheeld/quickReturnHeader/build.gradle'),
|
||||
Path('source-files/com.integreight.onesheeld/pullToRefreshlibrary/src/main/AndroidManifest.xml'),
|
||||
Path('source-files/com.integreight.onesheeld/pullToRefreshlibrary/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1140,7 +1140,7 @@ class CommonTest(unittest.TestCase):
|
||||
app = fdroidserver.metadata.App()
|
||||
app.id = 'dev.patrickgold.florisboard'
|
||||
paths = [
|
||||
os.path.join('source-files', 'dev.patrickgold.florisboard', 'app', 'build.gradle.kts'),
|
||||
Path('source-files/dev.patrickgold.florisboard/app/build.gradle.kts'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1150,8 +1150,8 @@ class CommonTest(unittest.TestCase):
|
||||
app = fdroidserver.metadata.App()
|
||||
app.id = 'com.ubergeek42.WeechatAndroid'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.ubergeek42.WeechatAndroid', 'app', 'build.gradle.kts'),
|
||||
os.path.join('source-files', 'com.ubergeek42.WeechatAndroid', 'app', 'src', 'main', 'res', 'values', 'strings.xml'),
|
||||
Path('source-files/com.ubergeek42.WeechatAndroid/app/build.gradle.kts'),
|
||||
Path('source-files/com.ubergeek42.WeechatAndroid/app/src/main/res/values/strings.xml'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1163,8 +1163,8 @@ class CommonTest(unittest.TestCase):
|
||||
app.id = 'org.fdroid.fdroid'
|
||||
app.UpdateCheckIgnore = '-test'
|
||||
paths = [
|
||||
os.path.join('source-files', 'fdroid', 'fdroidclient', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'fdroid', 'fdroidclient', 'build.gradle'),
|
||||
Path('source-files/fdroid/fdroidclient/AndroidManifest.xml'),
|
||||
Path('source-files/fdroid/fdroidclient/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1178,8 +1178,8 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'org.fdroid.fdroid.dev'
|
||||
paths = [
|
||||
os.path.join('source-files', 'fdroid', 'fdroidclient', 'AndroidManifest.xml'),
|
||||
os.path.join('source-files', 'fdroid', 'fdroidclient', 'build.gradle'),
|
||||
Path('source-files/fdroid/fdroidclient/AndroidManifest.xml'),
|
||||
Path('source-files/fdroid/fdroidclient/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1192,7 +1192,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'eu.siacs.conversations'
|
||||
paths = [
|
||||
os.path.join('source-files', 'eu.siacs.conversations', 'build.gradle'),
|
||||
Path('source-files/eu.siacs.conversations/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1205,7 +1205,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.nextcloud.client'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.nextcloud.client', 'build.gradle'),
|
||||
Path('source-files/com.nextcloud.client/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1218,7 +1218,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.nextcloud.android.beta'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.nextcloud.client', 'build.gradle'),
|
||||
Path('source-files/com.nextcloud.client/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1231,7 +1231,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'at.bitfire.davdroid'
|
||||
paths = [
|
||||
os.path.join('source-files', 'at.bitfire.davdroid', 'build.gradle'),
|
||||
Path('source-files/at.bitfire.davdroid/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1244,7 +1244,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.libre'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'),
|
||||
Path('source-files/com.kunzisoft.testcase/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1257,7 +1257,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.pro'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'),
|
||||
Path('source-files/com.kunzisoft.testcase/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1270,7 +1270,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'),
|
||||
Path('source-files/com.kunzisoft.testcase/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1283,7 +1283,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'),
|
||||
Path('source-files/com.kunzisoft.testcase/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1296,7 +1296,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'),
|
||||
Path('source-files/com.kunzisoft.testcase/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1309,7 +1309,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.github.jameshnsears.quoteunquote'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.github.jameshnsears.quoteunquote', 'build.gradle'),
|
||||
Path('source-files/com.github.jameshnsears.quoteunquote/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1322,7 +1322,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'com.jens.automation2'
|
||||
paths = [
|
||||
os.path.join('source-files', 'com.jens.automation2', 'build.gradle'),
|
||||
Path('source-files/com.jens.automation2/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1335,7 +1335,7 @@ class CommonTest(unittest.TestCase):
|
||||
app['Builds'] = [build]
|
||||
app.id = 'de.varengold.activeTAN'
|
||||
paths = [
|
||||
os.path.join('source-files', 'de.varengold.activeTAN', 'build.gradle'),
|
||||
Path('source-files/de.varengold.activeTAN/build.gradle'),
|
||||
]
|
||||
for path in paths:
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
@ -1364,8 +1364,7 @@ class CommonTest(unittest.TestCase):
|
||||
abspath = Path(self.basedir) / 'source-files/realm'
|
||||
p = fdroidserver.common.get_all_gradle_and_manifests(abspath)
|
||||
self.assertEqual(1, len(p))
|
||||
# TODO: Pathon3.9: self.assertTrue(p[0].is_relative_to(abspath))
|
||||
self.assertTrue(abspath in p[0].parents)
|
||||
self.assertTrue(p[0].is_relative_to(abspath))
|
||||
|
||||
def test_get_gradle_subdir(self):
|
||||
subdirs = {
|
||||
@ -2274,8 +2273,7 @@ class CommonTest(unittest.TestCase):
|
||||
"seven",
|
||||
]
|
||||
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
|
||||
# TODO: Python3.6: Should accept path-like
|
||||
repo = git.Repo.init(str(Path.cwd()))
|
||||
repo = git.Repo.init(Path.cwd())
|
||||
f = Path("test")
|
||||
date = 10**9
|
||||
for tag in tags:
|
||||
@ -2291,8 +2289,7 @@ class CommonTest(unittest.TestCase):
|
||||
def test_vcs_git_getref(self):
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
|
||||
# TODO: Python3.6: Should accept path-like
|
||||
repo = git.Repo.init(str(Path.cwd()))
|
||||
repo = git.Repo.init(Path.cwd())
|
||||
tag = "1.1.1"
|
||||
f = Path("test")
|
||||
f.write_text(tag)
|
||||
|
@ -78,14 +78,11 @@ class ImportTest(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
for appid, url, vn, vc in data:
|
||||
# TODO: Python3.6: Accepts a path-like object.
|
||||
shutil.rmtree(
|
||||
str(tmp_importer),
|
||||
tmp_importer,
|
||||
onerror=fdroidserver.import_subcommand.handle_retree_error_on_windows,
|
||||
)
|
||||
shutil.copytree(
|
||||
str(self.basedir / 'source-files' / appid), str(tmp_importer)
|
||||
)
|
||||
shutil.copytree(self.basedir / 'source-files' / appid, tmp_importer)
|
||||
|
||||
app = fdroidserver.import_subcommand.get_app_from_url(url)
|
||||
with mock.patch(
|
||||
|
@ -29,8 +29,7 @@ class LintTest(unittest.TestCase):
|
||||
self.basedir = localmodule / 'tests'
|
||||
self.tmpdir = localmodule / '.testfiles'
|
||||
self.tmpdir.mkdir(exist_ok=True)
|
||||
# TODO: Python3.6: Accepts a path-like object.
|
||||
os.chdir(str(self.basedir))
|
||||
os.chdir(self.basedir)
|
||||
|
||||
def test_check_for_unsupported_metadata_files(self):
|
||||
self.assertTrue(fdroidserver.lint.check_for_unsupported_metadata_files())
|
||||
@ -40,10 +39,9 @@ class LintTest(unittest.TestCase):
|
||||
self.assertFalse(
|
||||
fdroidserver.lint.check_for_unsupported_metadata_files(testdir)
|
||||
)
|
||||
# TODO: Python3.6: Accepts a path-like object.
|
||||
shutil.copytree(
|
||||
str(self.basedir / 'metadata'),
|
||||
str(testdir / 'metadata'),
|
||||
self.basedir / 'metadata',
|
||||
testdir / 'metadata',
|
||||
ignore=shutil.ignore_patterns('apk', 'dump', '*.json'),
|
||||
)
|
||||
self.assertFalse(
|
||||
|
@ -349,12 +349,10 @@ class MetadataTest(unittest.TestCase):
|
||||
random.shuffle(randomapps)
|
||||
i = 1
|
||||
for f in randomapps:
|
||||
# TODO: Pytohn3.6: The parameter now accepts a path-like object.
|
||||
shutil.copy(str(f), str(metadatadir))
|
||||
shutil.copy(f, metadatadir)
|
||||
new = metadatadir / f.name
|
||||
stat = new.stat()
|
||||
# TODO: Changed in version 3.6: Accepts a path-like object.
|
||||
os.utime(str(new), (stat.st_ctime, stat.st_mtime + i))
|
||||
os.utime(new, (stat.st_ctime, stat.st_mtime + i))
|
||||
# prepend new item so newest is always first
|
||||
randomlist = [f.stem] + randomlist
|
||||
i += 1
|
||||
|
@ -29,8 +29,7 @@ class RewriteMetaTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
self.basedir = localmodule / 'tests'
|
||||
# TODO: Python3.6: Accepts a path-like object.
|
||||
os.chdir(str(self.basedir))
|
||||
os.chdir(self.basedir)
|
||||
|
||||
def test_rewrite_scenario_trivial(self):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user