3
Refresh any files in ../virtualenv_support/ that come from elsewhere
8
from urllib.request import urlopen
10
from urllib2 import urlopen
13
here = os.path.dirname(__file__)
14
support_location = os.path.join(here, '..', 'virtualenv_support')
15
embedded_location = os.path.join(here, '..', 'virtualenv_embedded')
18
('http://peak.telecommunity.com/dist/ez_setup.py', 'ez_setup.py'),
19
('http://python-distribute.org/distribute_setup.py', 'distribute_setup.py'),
23
('http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg', 'setuptools-0.6c11-py2.6.egg'),
24
('http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg', 'setuptools-0.6c11-py2.5.egg'),
25
('http://pypi.python.org/packages/source/d/distribute/distribute-0.6.31.tar.gz', 'distribute-0.6.31.tar.gz'),
26
('http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz', 'pip-1.2.1.tar.gz'),
30
def refresh_files(files, location):
31
for url, filename in files:
32
sys.stdout.write('fetching %s ... ' % url)
38
filename = os.path.join(location, filename)
39
if os.path.exists(filename):
40
f = open(filename, 'rb')
41
cur_content = f.read()
45
if cur_content == content:
46
print(' %s up-to-date' % filename)
48
print(' overwriting %s' % filename)
49
f = open(filename, 'wb')
55
refresh_files(embedded_files, embedded_location)
56
refresh_files(support_files, support_location)
58
if __name__ == '__main__':