OLD | NEW |
1 #!python | 1 #!python |
2 | 2 |
3 # This file was obtained from: | 3 # This file was obtained from: |
4 # http://peak.telecommunity.com/dist/ez_setup.py | 4 # http://peak.telecommunity.com/dist/ez_setup.py |
5 # on 2009/4/17. | 5 # on 2011/1/21. |
6 | 6 |
7 """Bootstrap setuptools installation | 7 """Bootstrap setuptools installation |
8 | 8 |
9 If you want to use setuptools in your package's setup.py, just include this | 9 If you want to use setuptools in your package's setup.py, just include this |
10 file in the same directory with it, and add this to the top of your setup.py:: | 10 file in the same directory with it, and add this to the top of your setup.py:: |
11 | 11 |
12 from ez_setup import use_setuptools | 12 from ez_setup import use_setuptools |
13 use_setuptools() | 13 use_setuptools() |
14 | 14 |
15 If you want to require a specific version of setuptools, set a download | 15 If you want to require a specific version of setuptools, set a download |
16 mirror, or use an alternate download directory, you can do so by supplying | 16 mirror, or use an alternate download directory, you can do so by supplying |
17 the appropriate options to ``use_setuptools()``. | 17 the appropriate options to ``use_setuptools()``. |
18 | 18 |
19 This file can also be run as a script to install or upgrade setuptools. | 19 This file can also be run as a script to install or upgrade setuptools. |
20 """ | 20 """ |
21 import sys | 21 import sys |
22 DEFAULT_VERSION = "0.6c9" | 22 DEFAULT_VERSION = "0.6c11" |
23 DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.versi
on[:3] | 23 DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.versi
on[:3] |
24 | 24 |
25 md5_data = { | 25 md5_data = { |
26 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', | 26 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', |
27 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', | 27 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', |
28 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', | 28 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', |
29 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', | 29 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', |
30 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', | 30 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', |
31 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', | 31 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', |
32 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', | 32 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', |
33 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', | 33 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', |
34 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', | 34 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', |
35 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', | 35 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', |
| 36 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090', |
| 37 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', |
| 38 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', |
| 39 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5', |
| 40 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de', |
| 41 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b', |
| 42 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2', |
| 43 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086', |
36 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', | 44 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', |
37 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', | 45 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', |
38 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', | 46 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', |
39 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', | 47 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', |
40 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', | 48 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', |
41 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', | 49 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', |
42 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', | 50 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', |
43 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', | 51 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', |
44 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', | 52 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', |
45 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', | 53 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 pkg_resources.require("setuptools>="+version); return | 110 pkg_resources.require("setuptools>="+version); return |
103 except pkg_resources.VersionConflict, e: | 111 except pkg_resources.VersionConflict, e: |
104 if was_imported: | 112 if was_imported: |
105 print >>sys.stderr, ( | 113 print >>sys.stderr, ( |
106 "The required version of setuptools (>=%s) is not available, and\n" | 114 "The required version of setuptools (>=%s) is not available, and\n" |
107 "can't be installed while this script is running. Please install\n" | 115 "can't be installed while this script is running. Please install\n" |
108 " a more recent version first, using 'easy_install -U setuptools'." | 116 " a more recent version first, using 'easy_install -U setuptools'." |
109 "\n\n(Currently using %r)" | 117 "\n\n(Currently using %r)" |
110 ) % (version, e.args[0]) | 118 ) % (version, e.args[0]) |
111 sys.exit(2) | 119 sys.exit(2) |
112 else: | |
113 del pkg_resources, sys.modules['pkg_resources'] # reload ok | |
114 return do_download() | |
115 except pkg_resources.DistributionNotFound: | 120 except pkg_resources.DistributionNotFound: |
116 return do_download() | 121 pass |
| 122 |
| 123 del pkg_resources, sys.modules['pkg_resources'] # reload ok |
| 124 return do_download() |
117 | 125 |
118 def download_setuptools( | 126 def download_setuptools( |
119 version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, | 127 version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, |
120 delay = 15 | 128 delay = 15 |
121 ): | 129 ): |
122 """Download setuptools from a specified location and return its filename | 130 """Download setuptools from a specified location and return its filename |
123 | 131 |
124 `version` should be a valid setuptools version number that is available | 132 `version` should be a valid setuptools version number that is available |
125 as an egg for download under the `download_base` URL (which should end | 133 as an egg for download under the `download_base` URL (which should end |
126 with a '/'). `to_dir` is the directory where the egg will be downloaded. | 134 with a '/'). `to_dir` is the directory where the egg will be downloaded. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 f = open(srcfile,'w') | 274 f = open(srcfile,'w') |
267 f.write(src) | 275 f.write(src) |
268 f.close() | 276 f.close() |
269 | 277 |
270 | 278 |
271 if __name__=='__main__': | 279 if __name__=='__main__': |
272 if len(sys.argv)>2 and sys.argv[1]=='--md5update': | 280 if len(sys.argv)>2 and sys.argv[1]=='--md5update': |
273 update_md5(sys.argv[2:]) | 281 update_md5(sys.argv[2:]) |
274 else: | 282 else: |
275 main(sys.argv[1:]) | 283 main(sys.argv[1:]) |
276 | |
277 | |
278 | |
279 | |
280 | |
281 | |
OLD | NEW |