Mercurial > hg > PaInt
comparison paint/info.py @ 57:d5e5c7496784
stubbing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 23 Jan 2013 16:26:14 -0800 |
parents | 042a1b2a3e8a |
children | 13767ee2ddf4 |
comparison
equal
deleted
inserted
replaced
56:042a1b2a3e8a | 57:d5e5c7496784 |
---|---|
1 """ | 1 """ |
2 interfaces to get information from a package | 2 interfaces to get information from a package |
3 """ | 3 """ |
4 | 4 |
5 import imp | |
5 import os | 6 import os |
6 import sys | 7 import sys |
8 | |
9 from subprocess import check_call as call | |
7 | 10 |
8 class PackageInfo(object): | 11 class PackageInfo(object): |
9 """abstract base class of package info""" | 12 """abstract base class of package info""" |
10 def __init__(self, path): | 13 def __init__(self, path): |
11 """ | 14 """ |
28 def __call__(self): | 31 def __call__(self): |
29 setuptools = sys.modules.get('setuptools') | 32 setuptools = sys.modules.get('setuptools') |
30 sys.modules['setuptools'] = sys.modules[__name__] | 33 sys.modules['setuptools'] = sys.modules[__name__] |
31 globals()['setup'] = self._setup | 34 globals()['setup'] = self._setup |
32 try: | 35 try: |
33 module = imp.load_source('setup', setup_py) | 36 module = imp.load_source('setup', self.setup_py) |
34 finally: | 37 finally: |
35 sys.modules.pop('setuptools') | 38 sys.modules.pop('setuptools') |
36 if setuptools: | 39 if setuptools: |
37 sys.modules['setuptools'] = setuptools | 40 sys.modules['setuptools'] = setuptools |
38 globals().pop('setup') | 41 globals().pop('setup') |
39 return self.__dict__.pop('_info') | 42 return self.__dict__.pop('_info') |
40 | 43 |
41 def _setup(self, **kwargs): | 44 def _setup(self, **kwargs): |
42 self._info = kwargs | 45 self._info = kwargs |
46 | |
47 class EggInfo(PackageInfo): | |
48 """ | |
49 use `python setup.py egg_info` to gather package information | |
50 """ | |
51 | |
52 def __call__(self): | |
53 raise NotImplementedError("TODO") | |
54 | |
55 def _egg_info(self): | |
56 """build the egg_info directory""" | |
57 | |
58 if self._egg_info_path: | |
59 return self._egg_info_path | |
60 | |
61 raise NotImplementedError("TODO") |