# HG changeset patch # User Jeff Hammel # Date 1333147597 25200 # Node ID cc25499e9485685dc43ad48633ab985b8b94dbc3 # Parent c9d8abb2026f362eccd83ac0c7ba6451ed4a759d note TODO....and cry a little diff -r c9d8abb2026f -r cc25499e9485 paint/package.py --- a/paint/package.py Fri Mar 30 15:10:49 2012 -0700 +++ b/paint/package.py Fri Mar 30 15:46:37 2012 -0700 @@ -124,13 +124,21 @@ raise AssertionError("%s does not exist" % setup_py) # setup the egg info + exception = None try: - call([sys.executable, 'setup.py', 'egg_info'], cwd=directory, stdout=subprocess.PIPE) - except BaseException, e: - print "Failure to generate egg_info" - print ' - src: %s' % self.src - print ' - directory: %s' % directory - raise + code = call([sys.executable, 'setup.py', 'egg_info'], cwd=directory, stdout=subprocess.PIPE) + except BaseException, exception: + pass + if code or exception: + message = """Failure to generate egg_info +- src: %s +- directory: %s +""" % (self.src, directory) + if exception: + sys.stderr.write(message) + raise exception + else: + raise Exception(message) # get the .egg-info directory egg_info = [i for i in os.listdir(directory) @@ -147,10 +155,17 @@ """return info dictionary for package""" # could use pkginfo - egg_info = self._egg_info() + if self._pkg_info_path: + pkg_info = self._pkg_info_path + else: + try: + egg_info = self._egg_info() + pkg_info = os.path.join(egg_info, 'PKG-INFO') + except BaseException, exception: + # try to get the package info from a file + raise NotImplementedError("TODO: try to get the package info from a file") # read the package information - pkg_info = os.path.join(egg_info, 'PKG-INFO') info_dict = {} for line in file(pkg_info).readlines(): if not line or line[0].isspace():