comparison python/dependencies.py @ 258:2862f4453296

add a hack to override setuptools
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 02 Jan 2013 15:41:11 -0800
parents
children a529f0d3c259
comparison
equal deleted inserted replaced
257:f4594857d606 258:2862f4453296
1 #!/usr/bin/env python
2
3 import imp
4 import os
5 import pprint
6 import sys
7
8 current_module = None
9 info = {}
10
11 def setup(**kwargs):
12 assert current_module
13 info[current_module] = kwargs
14
15 def main(args=sys.argv[1:]):
16
17 global current_module
18 current_module = None
19
20 setuptools = sys.modules.get('setuptools')
21 sys.modules['setuptools'] = sys.modules[__name__]
22
23 try:
24 for setup_py in args:
25 current_module = setup_py
26 assert os.path.exists(setup_py)
27 module = imp.load_source('setup', setup_py)
28 except:
29 sys.modules.pop('setuptools')
30 if setuptools:
31 sys.modules['setuptools'] = setuptoools
32
33 pprint.pprint(info)
34
35 if __name__ == '__main__':
36 main()