~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/python/virtualenv/bin/refresh-support-files.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
"""
 
3
Refresh any files in ../virtualenv_support/ that come from elsewhere
 
4
"""
 
5
 
 
6
import os
 
7
try:
 
8
    from urllib.request import urlopen
 
9
except ImportError:
 
10
    from urllib2 import urlopen
 
11
import sys
 
12
 
 
13
here = os.path.dirname(__file__)
 
14
support_location = os.path.join(here, '..', 'virtualenv_support')
 
15
embedded_location = os.path.join(here, '..', 'virtualenv_embedded')
 
16
 
 
17
embedded_files = [
 
18
    ('http://peak.telecommunity.com/dist/ez_setup.py', 'ez_setup.py'),
 
19
    ('http://python-distribute.org/distribute_setup.py', 'distribute_setup.py'),
 
20
]
 
21
 
 
22
support_files = [
 
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'),
 
27
]
 
28
 
 
29
 
 
30
def refresh_files(files, location):
 
31
    for url, filename in files:
 
32
        sys.stdout.write('fetching %s ... ' % url)
 
33
        sys.stdout.flush()
 
34
        f = urlopen(url)
 
35
        content = f.read()
 
36
        f.close()
 
37
        print('done.')
 
38
        filename = os.path.join(location, filename)
 
39
        if os.path.exists(filename):
 
40
            f = open(filename, 'rb')
 
41
            cur_content = f.read()
 
42
            f.close()
 
43
        else:
 
44
            cur_content = ''
 
45
        if cur_content == content:
 
46
            print('  %s up-to-date' % filename)
 
47
        else:
 
48
            print('  overwriting %s' % filename)
 
49
            f = open(filename, 'wb')
 
50
            f.write(content)
 
51
            f.close()
 
52
 
 
53
 
 
54
def main():
 
55
    refresh_files(embedded_files, embedded_location)
 
56
    refresh_files(support_files, support_location)
 
57
 
 
58
if __name__ == '__main__':
 
59
    main()