comparison paint/info.py @ 67:8f39ba642531

random stubbing
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 25 Jan 2013 15:56:26 -0800
parents 1234bfb1f1f0
children d001017d5870
comparison
equal deleted inserted replaced
66:af7609457dc6 67:8f39ba642531
17 # {'entry_points': '\n', 'description': 'a dummy package', 'license': '', 'author': 'Jeff Hammel', 'install_requires': [], 'include_package_data': True, 'classifiers': [], 'url': 'http://example.com/', 'author_email': 'jhammel@mozilla.com', 'version': '0.1', 'zip_safe': False, 'packages': ['dummy'], 'long_description': 'dummy\n===========\n\na dummy package\n\n----\n\nJeff Hammel\n\nhttp://example.com/\n\n', 'name': 'dummy'} 17 # {'entry_points': '\n', 'description': 'a dummy package', 'license': '', 'author': 'Jeff Hammel', 'install_requires': [], 'include_package_data': True, 'classifiers': [], 'url': 'http://example.com/', 'author_email': 'jhammel@mozilla.com', 'version': '0.1', 'zip_safe': False, 'packages': ['dummy'], 'long_description': 'dummy\n===========\n\na dummy package\n\n----\n\nJeff Hammel\n\nhttp://example.com/\n\n', 'name': 'dummy'}
18 18
19 # EggInfo: 19 # EggInfo:
20 # {'Name': 'dummy', 'License': 'UNKNOWN', 'Author': 'Jeff Hammel', 'Metadata-Version': '1.0', 'Home-page': 'http://example.com/', 'Summary': 'a dummy package', 'Platform': 'UNKNOWN', 'Version': '0.1', 'Author-email': 'jhammel@mozilla.com', 'Description': 'dummy'} 20 # {'Name': 'dummy', 'License': 'UNKNOWN', 'Author': 'Jeff Hammel', 'Metadata-Version': '1.0', 'Home-page': 'http://example.com/', 'Summary': 'a dummy package', 'Platform': 'UNKNOWN', 'Version': '0.1', 'Author-email': 'jhammel@mozilla.com', 'Description': 'dummy'}
21 21
22 # see http://www.python.org/dev/peps/pep-0314/ :
23 # Metadata for Python Software Packages
22 24
23 class PackageInfo(object): 25 class PackageInfo(object):
24 """abstract base class of package info""" 26 """abstract base class of package info"""
25 def __init__(self, path): 27 def __init__(self, path):
26 """ 28 """
33 35
34 def __call__(self): 36 def __call__(self):
35 """returns dictionary of package info""" 37 """returns dictionary of package info"""
36 raise NotImplementedError("abstract base class") 38 raise NotImplementedError("abstract base class")
37 39
40
38 class SetupOverridePackageInfo(PackageInfo): 41 class SetupOverridePackageInfo(PackageInfo):
39 """ 42 """
40 gather setup.py information by overriding the function 43 gather setup.py information by overriding the function
41 """ 44 """
45 # TODO: override distutils.core.setup as well
46 # http://docs.python.org/2/distutils/index.html#distutils-index
42 47
43 def __call__(self): 48 def __call__(self):
44 setuptools = sys.modules.get('setuptools') 49 setuptools = sys.modules.get('setuptools')
45 sys.modules['setuptools'] = sys.modules[__name__] 50 sys.modules['setuptools'] = sys.modules[__name__]
46 globals()['setup'] = self._setup 51 globals()['setup'] = self._setup
53 globals().pop('setup') 58 globals().pop('setup')
54 return self.__dict__.pop('_info') 59 return self.__dict__.pop('_info')
55 60
56 def _setup(self, **kwargs): 61 def _setup(self, **kwargs):
57 self._info = kwargs 62 self._info = kwargs
63
58 64
59 class EggInfo(PackageInfo): 65 class EggInfo(PackageInfo):
60 """ 66 """
61 use `python setup.py egg_info` to gather package information 67 use `python setup.py egg_info` to gather package information
62 """ 68 """