Mercurial > hg > PaInt
changeset 66:af7609457dc6
introduce a failing test; yay!
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 25 Jan 2013 13:50:40 -0800 |
parents | 6d6f5c5c26d4 |
children | 8f39ba642531 |
files | paint/package.py |
diffstat | 1 files changed, 1 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/paint/package.py Fri Jan 25 13:46:11 2013 -0800 +++ b/paint/package.py Fri Jan 25 13:50:40 2013 -0800 @@ -124,88 +124,12 @@ ### python-package-specific functionality - def _egg_info(self): - """build the egg_info directory""" - - if self._egg_info_path: - # return cached copy - return self._egg_info_path - - directory = self._path() - setup_py = os.path.join(directory, 'setup.py') - if not os.path.exists(setup_py): - raise AssertionError("%s does not exist" % setup_py) - - # setup the egg info - exception = None - try: - code = call([sys.executable, 'setup.py', 'egg_info'], cwd=directory, stdout=subprocess.PIPE) - except Exception, 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) - if i.endswith('.egg-info')] - assert len(egg_info) == 1, 'Expected one .egg-info directory in %s, got: %s' % (directory, egg_info) - egg_info = os.path.join(directory, egg_info[0]) - assert os.path.isdir(egg_info), "%s is not a directory" % egg_info - - # cache it - self._egg_info_path = egg_info - return self._egg_info_path - - def _pkg_info(self): - """returns path to PKG-INFO file""" - - if self._pkg_info_path: - # return cached value - return self._pkg_info_path - - try: - egg_info = self._egg_info() - except Exception, exception: - # try to get the package info from a file - path = self._path() - pkg_info = os.path.join(path, 'PKG-INFO') - if os.path.exists(pkg_info): - self._pkg_info_path = pkg_info - return self._pkg_info_path - raise Exception("Cannot find or generate PKG-INFO") - - pkg_info = os.path.join(egg_info, 'PKG-INFO') - assert os.path.exists(pkg_info) - self._pkg_info_path = pkg_info - return self._pkg_info_path - def info(self): """return info dictionary for package""" # could use pkginfo module self._log(">>> Getting the info") - - pkg_info = self._pkg_info() - - # read the package information - info_dict = {} - for line in file(pkg_info).readlines(): - if not line or line[0].isspace(): - continue # XXX neglects description - assert ':' in line - key, value = [i.strip() for i in line.split(':', 1)] - info_dict[key] = value - - # return the information - return info_dict + return self.package_info(self._path())() def dependencies(self): """return the dependencies"""