From 9286ef67b2eb6ad8f1b989f757a1cccd9548810c Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 19 Dec 2014 14:43:02 -0300 Subject: Some pep8 fixes and code cleanup. --- bundler/depcollector.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'bundler') diff --git a/bundler/depcollector.py b/bundler/depcollector.py index 0315b3f..4259c46 100644 --- a/bundler/depcollector.py +++ b/bundler/depcollector.py @@ -4,7 +4,6 @@ import errno from distutils import dir_util, file_util from modulegraph import modulegraph -from utils import IS_WIN def mkdir_p(path): @@ -13,10 +12,15 @@ def mkdir_p(path): except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(path): pass - else: raise + else: + raise + def collect_deps(root, dest_lib_dir, path_file): - mg = modulegraph.ModuleGraph([sys.path[0]] + [x.strip() for x in open(path_file, 'r').readlines()] + sys.path[1:])#, debug=3) + mg = modulegraph.ModuleGraph( + [sys.path[0]] + + [x.strip() for x in open(path_file, 'r').readlines()] + + sys.path[1:]) # , debug=3) mg.import_hook("distutils") mg.import_hook("site") @@ -39,15 +43,20 @@ def collect_deps(root, dest_lib_dir, path_file): mg.import_hook("daemon") # for leap/bitmask/util/polkit_agent.py mg.run_script(root) - packages = [mg.findNode(i) for i in ["leap.common", "leap.keymanager", "leap.mail", "leap.soledad.client", "leap.soledad.common", "jsonschema"]] + packages = [mg.findNode(i) for i in ["leap.common", "leap.keymanager", + "leap.mail", "leap.soledad.client", + "leap.soledad.common", "jsonschema"]] other = [] - sorted_pkg = [(os.path.basename(mod.identifier), mod) for mod in mg.flatten()] + sorted_pkg = [(os.path.basename(m.identifier), m) for m in mg.flatten()] sorted_pkg.sort() + for (name, pkg) in sorted_pkg: # skip namespace packages - if name == "leap" or name == "leap.soledad" or name == "google" or name == "zope" or name.endswith("leap/bitmask/app.py"): + if name in ("leap", "leap.soledad", "google", "zope") or \ + name.endswith("leap/bitmask/app.py"): continue + # print pkg if isinstance(pkg, modulegraph.MissingModule): # print "ignoring", pkg.identifier @@ -66,7 +75,7 @@ def collect_deps(root, dest_lib_dir, path_file): continue if pkg not in packages: packages.append(pkg) - else: #if isinstance(pkg, modulegraph.Extension): + else: # if isinstance(pkg, modulegraph.Extension): foundpackage = False for i in packages: if pkg.identifier.startswith(i.identifier): @@ -80,7 +89,6 @@ def collect_deps(root, dest_lib_dir, path_file): continue other.append(pkg) # print pkg.identifier - #import pdb; pdb.set_trace() print "Packages", len(packages) for i in sorted(packages): -- cgit v1.2.3