if len(changes_files) > 0:
utils.warn("Directory provided so ignoring files given on command line")
- dir = Cnf["Dinstall::Options::Directory"]
- try:
- # Much of the rest of p-a depends on being in the right place
- os.chdir(dir)
- changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
- except OSError, e:
- utils.fubar("Failed to read list from directory %s (%s)" % (dir, e))
+ changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
Upload = queue.Upload(Cnf)
projectB = Upload.projectB
if len(changes_files) > 0:
utils.warn("Directory provided so ignoring files given on command line")
- dir = Cnf["Dinstall::Options::Directory"]
- try:
- # Much of the rest of p-u depends on being in the right place
- os.chdir(dir)
- changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
- except OSError, e:
- utils.fubar("Failed to read list from directory %s (%s)" % (dir, e))
+ changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
Upload = queue.Upload(Cnf)
################################################################################
+def get_changes_files(dir):
+ try:
+ # Much of the rest of p-u/p-a depends on being in the right place
+ os.chdir(dir)
+ changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
+ except OSError, e:
+ fubar("Failed to read list from directory %s (%s)" % (dir, e))
+
+ return changes_files
+
+################################################################################
+
apt_pkg.init()
Cnf = apt_pkg.newConfiguration()