#56 spectool: create parent directory if required + fix _sourcedir expansion
Merged 3 years ago by ngompa. Opened 3 years ago by decathorpe.
Unknown source master  into  master

file modified
+2 -7
@@ -278,6 +278,7 @@

              if not dry:

                  try:

                      print("Downloading: {}".format(value))

+                     os.makedirs(directory, exist_ok=True)

                      really = get_file(value, os.path.join(directory, basename), force)

                      if really:

                          print("Downloaded: {}".format(basename))
@@ -391,13 +392,7 @@

          if args["directory"]:

              directory = args["directory"]

          elif args["sourcedir"]:

-             ret = subprocess.run(

-                 ["rpm", "--eval", "%{_sourcedir}"],

-                 stdout=subprocess.PIPE,

-                 stderr=subprocess.STDOUT,

-             )

-             ret.check_returncode()

-             directory = ret.stdout.decode().strip()

+             directory = rpm.expandMacro("%{_sourcedir}")

          else:

              directory = os.getcwd()

  

  • create download directory if it doesn't exist yet
  • use RPM do parse %_sourcedir after having parsed the .spec file

Fixes: #39
Fixes: #40

From the first glance, LGTM.

Pull-Request has been merged by ngompa

3 years ago
Metadata