From 105be007b4771dc108fb74ac589576a144b4e3af Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 22 Jan 2011 16:34:20 +0100 Subject: Have PackageModule require a path The definition of the --path argument to fedpkg in parse_cmdline() already makes os.getcwd() the default value for args.path. Thus, we can get rid of the code providing the very same default for the path in PackageModule.__init__(). Also, make sure the path actually exists and is a directory. --- src/pyfedpkg/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 5c3afcd..e04191a 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1032,12 +1032,12 @@ class PackageModule: return subprocess.Popen(['rpm --eval %{_arch}'], shell=True, stdout=subprocess.PIPE).communicate()[0].strip('\n') - def __init__(self, path=None): + def __init__(self, path): # Initiate a PackageModule object in a given path # Set some global variables used throughout - if not path: - path = os.getcwd() log.debug('Creating module object from %s' % path) + if not os.path.isdir(path): + raise FedpkgError('Module directory not found: %s' % path) self.path = path self.lookaside = LOOKASIDE self.lookasidehash = LOOKASIDEHASH -- cgit