Mercurial > hg > PaInt
changeset 39:cc25499e9485
note TODO....and cry a little
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 30 Mar 2012 15:46:37 -0700 |
parents | c9d8abb2026f |
children | 06f21791eba1 |
files | paint/package.py |
diffstat | 1 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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():