File: makepip.py

package info (click to toggle)
python-pip 9.0.1-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,900 kB
  • sloc: python: 51,824; makefile: 206; sh: 52
file content (27 lines) | stat: -rw-r--r-- 654 bytes parent folder | download
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
27
"""Make the /usr/bin/pip* scripts which honor the distro wheels."""

TEMPLATE = """\
#!{shebang}
# GENERATED BY DEBIAN

import sys

# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
    sys.exit(main())
"""

# This is a one-off script, so just do stupid simple argument parsing.

import sys

substitutions = dict(
    shebang=sys.argv[1],
    )

output_file = sys.argv[2]
with open(output_file, 'w', encoding='utf-8') as fp:
    print(TEMPLATE.format(**substitutions), end='', file=fp)