From c7b68e963c77e4055a2b8fce6ca05d070e47b8e6 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 19 Jun 2014 18:43:48 +0200 Subject: Don't emulate os.path.join --- stagepkg/command.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'stagepkg') diff --git a/stagepkg/command.py b/stagepkg/command.py index cde620b..3bc8923 100644 --- a/stagepkg/command.py +++ b/stagepkg/command.py @@ -18,7 +18,7 @@ import optparse # move to conf file archive_root = "/home/debian-packages" default_arch = "i386" -incoming = "/mini-dinstall/incoming" +incoming = "mini-dinstall/incoming" conf_dir = "/etc/stagepkg/" list_dir = os.path.join(conf_dir, "lists") @@ -57,24 +57,27 @@ def get_files(changes_file): def get_subarchive(repo): - """in case we have a subarchive like foo-component return this - otherwise an empty string""" + """ + in case we have a subarchive like foo-component return this + otherwise an empty string + """ subarchive = repo.split('/',1)[0] - return [ '', subarchive+'/' ][subarchive != repo] + return [ '', subarchive ][subarchive != repo] def get_repo_path(repo): """This is a real (on disk) repository path""" - return "%s/%s" % (archive_root, repo) + return os.path.join(archive_root, repo) def get_incoming_path(archive): """Find the upload queue for this archive""" - return "%s/%s/%s" % (archive_root, archive, incoming) + return os.path.join(archive_root, archive, incoming) def guess_version(repo, pkg, arch): - res = glob.glob("%s/%s_*_%s.changes" % (get_repo_path(repo), pkg, arch)) + res = glob.glob(os.path.join(get_repo_path(repo), + "%s_*_%s.changes" % (pkg, arch))) if res: (dummy, version, dummy) = res[-1].split("_", 2) else: @@ -83,14 +86,15 @@ def guess_version(repo, pkg, arch): def get_changes_file_path(repo, pkg, version, arch): - return "%s/%s_%s_%s.changes" % (get_repo_path(repo), pkg, version, arch) + return os.path.join(get_repo_path(repo), + "%s_%s_%s.changes" % (pkg, version, arch)) def copy_files(files, repo_path, incoming_path): """copy files to the incoming queue""" dst = incoming_path for f in files: - src = "%s/%s" % (repo_path, f) + src = os.path.join(repo_path, f) if simulate: print("Copy: %s to %s" % (src, dst)) else: @@ -101,7 +105,7 @@ def link_files(files, repo_path, incoming_path): """link files to the incoming queue""" dst = incoming_path for f in files: - src = "%s/%s" % (repo_path, f) + src = os.path.join(repo_path, f) if simulate: print("Linking: %s to %s" % (src, dst)) else: @@ -144,7 +148,10 @@ def mangle_changes_file(changes_file, pkg, version, from_repo, to_repo, arch): changes += [ line ] changes = "".join(changes) - filename = get_changes_file_path(get_subarchive(to_repo)+"mini-dinstall/incoming", pkg, version, arch) + filename = get_changes_file_path(os.path.join(get_subarchive(to_repo), + "mini-dinstall", + "incoming"), + pkg, version, arch) if simulate: print print("Changes file %s" % (filename, )) @@ -177,7 +184,7 @@ def dump_changes_file(changes, dest): def remove_files(files, repo_path): - for tounlink in [ "%s/%s" % (repo_path, f) for f in files ]: + for tounlink in [ os.path.join(repo_path, f) for f in files ]: if simulate: print("Unlink: %s" % (tounlink, )) else: -- cgit v1.2.3