This repository was archived by the owner on Mar 31, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathinstall.py
More file actions
112 lines (105 loc) · 3.32 KB
/
Copy pathinstall.py
File metadata and controls
112 lines (105 loc) · 3.32 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import sys
from pythonz.commands import Command
from pythonz.installer.pythoninstaller import PythonInstaller, AlreadyInstalledError
from pythonz.log import logger
class InstallCommand(Command):
name = "install"
usage = "%prog [OPTIONS] VERSION"
summary = "Build and install the given version of python"
def __init__(self):
super(InstallCommand, self).__init__()
self.parser.add_option(
"-t", "--type",
dest="type",
default="cpython",
help="Type of Python version: cpython, stackless, pypy, pypy3 or jython."
)
self.parser.add_option(
"-f", "--force",
dest="force",
action="store_true",
default=False,
help="Force installation of Python even if tests fail."
)
self.parser.add_option(
"--run-tests",
dest="run_tests",
action="store_true",
default=False,
help="Run `make test` after compiling."
)
self.parser.add_option(
"-u", "--url",
dest="url",
default=None,
help="URL used to download the specified Python version."
)
self.parser.add_option(
"-F", "--file",
dest="file",
default=None,
help="File pointing to the Python version to be installed."
)
self.parser.add_option(
"-v", "--verbose",
dest="verbose",
action="store_true",
default=False,
help="Display log information on the console."
)
self.parser.add_option(
"-C", "--configure",
dest="configure",
default="",
metavar="CONFIGURE_OPTIONS",
help="Options passed directly to configure."
)
self.parser.add_option(
"--framework",
dest="framework",
action="store_true",
default=False,
help="Build Framework (macOS only)."
)
self.parser.add_option(
"--universal",
dest="universal",
action="store_true",
default=False,
help="Build for both 32 & 64 bit Intel (macOS only)."
)
self.parser.add_option(
"--shared",
dest="shared",
action="store_true",
default=False,
help="Build shared libraries."
)
self.parser.add_option(
"--reinstall",
dest="reinstall",
action="store_true",
default=False,
help="Reinstall Python version, if already installed."
)
self.parser.add_option(
"--external",
dest="external_path",
default="",
help="Install Python version in specified directory."
)
def run_command(self, options, args):
if not args:
self.parser.print_help()
sys.exit(1)
for arg in args:
try:
p = PythonInstaller.get_installer(arg, options)
p.install()
except AlreadyInstalledError as e:
logger.info(e)
except Exception:
import traceback
traceback.print_exc()
continue
InstallCommand()