annotate python/dependencies.py @ 370:4198a58cc520

adding aliases
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 21 Jul 2013 05:35:28 -0700
parents af52700d1ce0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
258
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
261
a529f0d3c259 docstring
Jeff Hammel <jhammel@mozilla.com>
parents: 258
diff changeset
3 """
a529f0d3c259 docstring
Jeff Hammel <jhammel@mozilla.com>
parents: 258
diff changeset
4 illustrate overriding ``setuptools.setup`` to read package data
a529f0d3c259 docstring
Jeff Hammel <jhammel@mozilla.com>
parents: 258
diff changeset
5 """
a529f0d3c259 docstring
Jeff Hammel <jhammel@mozilla.com>
parents: 258
diff changeset
6
258
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 import imp
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 import os
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 import pprint
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 import sys
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 current_module = None
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 info = {}
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 def setup(**kwargs):
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 assert current_module
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 info[current_module] = kwargs
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 def main(args=sys.argv[1:]):
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 global current_module
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 current_module = None
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 setuptools = sys.modules.get('setuptools')
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 sys.modules['setuptools'] = sys.modules[__name__]
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 try:
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 for setup_py in args:
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 current_module = setup_py
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 assert os.path.exists(setup_py)
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 module = imp.load_source('setup', setup_py)
262
af52700d1ce0 minor fix
Jeff Hammel <jhammel@mozilla.com>
parents: 261
diff changeset
32 finally:
258
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 sys.modules.pop('setuptools')
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34 if setuptools:
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
35 sys.modules['setuptools'] = setuptoools
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37 pprint.pprint(info)
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
38
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
39 if __name__ == '__main__':
2862f4453296 add a hack to override setuptools
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 main()