[projects/git-slug] try to expand %_topdir before defaulting to ~/rpm/packages

atler atler at pld-linux.org
Sat Oct 2 00:31:50 CEST 2021


commit 6b10bf1d87c65824a73b9d176f63af5ffcc38a4d
Author: Jan Palus <jpalus at fastmail.com>
Date:   Sat Oct 2 00:30:08 2021 +0200

    try to expand %_topdir before defaulting to ~/rpm/packages

 slug.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/slug.py b/slug.py
index 17a67e7..da4e575 100755
--- a/slug.py
+++ b/slug.py
@@ -222,9 +222,17 @@ def list_packages(options):
     for package in sorted(refs.heads):
         print(package)
 
+def default_packagesdir():
+    try:
+        import rpm
+        return rpm.expandMacro('%_topdir')
+    except:
+        return os.path.expanduser('~/rpm/packages')
+
+
 common_options = argparse.ArgumentParser(add_help=False)
 common_options.add_argument('-d', '--packagesdir', help='local directory with git repositories',
-    default=os.path.expanduser('~/rpm/packages'))
+    default=default_packagesdir())
 
 common_fetchoptions = argparse.ArgumentParser(add_help=False, parents=[common_options])
 common_fetchoptions.add_argument('-j', '--jobs', help='number of threads to use', default=cpu_count(), type=int)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/6b10bf1d87c65824a73b9d176f63af5ffcc38a4d



More information about the pld-cvs-commit mailing list