summaryrefslogtreecommitdiff
path: root/contrib/build-standalone
blob: 5b918b6a6e6120b98fce22c54b25743c51c70c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

import os
import sys
from packager import generate_script

here = os.path.dirname(os.path.abspath(__file__))
file_name = os.path.join(here, 'run-pip.py')

def main():
    sys.stdout.write("Creating standalone pip...")
    script = generate_script('import pip; pip.main()', ['pip'])
    f = open(file_name, 'w')
    try:
        f.write(script)
    finally:
        f.close()
    sys.stdout.write('done.\n')
    if hasattr(os, 'chmod'):
        oldmode = os.stat(file_name).st_mode & 07777
        newmode = (oldmode | 0555) & 07777
        os.chmod(file_name, newmode)
        sys.stdout.write('Made resulting file %s executable.\n\n' % file_name)

if __name__ == '__main__':
    main()