Minor code cleanup

This commit is contained in:
Eric Torres 2019-03-10 21:07:15 -07:00
parent bc54dd803a
commit 5dca985412
2 changed files with 8 additions and 12 deletions

View File

@ -59,14 +59,12 @@ def add_pkgfile(pkgfile, cachedir):
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
"-c", "-c", "--cachedir", help="alternative directory to use for moving package"
"--cachedir",
help="alternative directory to use for moving package"
) )
parser.add_argument( parser.add_argument(
"-d", "-d",
"--db-filename", "--db-filename",
help="alternative filename for database without extension" help="alternative filename for database without extension",
) )
parser.add_argument( parser.add_argument(
"-s", "-s",
@ -101,8 +99,8 @@ if __name__ == "__main__":
else: else:
cachedir = os.path.join("/var", "cache", "pacman", repo) cachedir = os.path.join("/var", "cache", "pacman", repo)
if args.db-filename is not None: if args.db_filename is not None:
db = os.path.join(cachedir, f"{args.db-filename}.{DB_EXT}") db = os.path.join(cachedir, f"{args.db_filename}.{DB_EXT}")
else: else:
db = os.path.join(cachedir, f"{repo}.{DB_EXT}") db = os.path.join(cachedir, f"{repo}.{DB_EXT}")

View File

@ -54,14 +54,12 @@ def del_pkgfile(pkg):
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
"-c", "-c", "--cachedir", help="alternative directory to use for moving package"
"--cachedir",
help="alternative directory to use for moving package"
) )
parser.add_argument( parser.add_argument(
"-d", "-d",
"--db-filename", "--db-filename",
help="alternative filename for database without extension" help="alternative filename for database without extension",
) )
parser.add_argument( parser.add_argument(
"-s", "-s",
@ -96,8 +94,8 @@ if __name__ == "__main__":
else: else:
cachedir = os.path.join("/var", "cache", "pacman", repo) cachedir = os.path.join("/var", "cache", "pacman", repo)
if args.db-filename is not None: if args.db_filename is not None:
db = os.path.join(cachedir, f"{args.db-filename}.{DB_EXT}") db = os.path.join(cachedir, f"{args.db_filename}.{DB_EXT}")
else: else:
db = os.path.join(cachedir, f"{repo}.{DB_EXT}") db = os.path.join(cachedir, f"{repo}.{DB_EXT}")