FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
relocatable-python/make_relocatable_python_framework.py at main · gregneagle/relocatable-python · GitHub
gregneagle
/
relocatable-python
Public
Notifications
You must be signed in to change notification settings
Fork
49
Star
162
Code
Issues
4
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
relocatable-python
/
make_relocatable_python_framework.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
108 lines (100 loc) · 3.59 KB
Breadcrumbs
relocatable-python
/
make_relocatable_python_framework.py
Copy path
File metadata and controls
executable file
·
108 lines (100 loc) · 3.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/python3
# encoding: utf-8
#
# Copyright 2018 Greg Neagle.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tool to build relocatable Python frameworks on macOS"""
from
__future__
import
print_function
import
optparse
from
locallibs
import
get
from
locallibs
.
fix
import
fix_broken_signatures
,
fix_other_things
from
locallibs
.
install
import
install_extras
from
locallibs
.
relocatablizer
import
relocatablize
def
main
():
"""Main"""
usage
=
"usage: %prog [options]"
parser
=
optparse
.
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"--destination"
,
default
=
"."
,
help
=
"Directory destination for the Python.framework"
,
)
parser
.
add_option
(
"--baseurl"
,
default
=
get
.
DEFAULT_BASEURL
,
help
=
"Override the base URL used to download the framework."
,
)
parser
.
add_option
(
"--os-version"
,
default
=
get
.
DEFAULT_OS_VERSION
,
help
=
"Override the macOS version of the downloaded pkg. "
'Current supported versions are "10.6", "10.9", and "11". '
"Not all Python version and macOS version combinations are valid."
,
)
parser
.
add_option
(
"--python-version"
,
default
=
get
.
DEFAULT_PYTHON_VERSION
,
help
=
"Override the version of the Python framework to be downloaded. "
"See available versions at "
"https://www.python.org/downloads/mac-osx/"
,
)
parser
.
add_option
(
"--pip-requirements"
,
default
=
None
,
help
=
"Path to a pip freeze requirements.txt file that describes extra "
"Python modules to be installed. If not provided, no modules will be installed."
,
)
parser
.
add_option
(
"--no-unsign"
,
dest
=
"unsign"
,
action
=
"store_false"
,
help
=
"Do not unsign binaries and libraries after they are relocatablized."
)
parser
.
add_option
(
"--upgrade-pip"
,
default
=
False
,
action
=
"store_true"
,
help
=
"Upgrade pip prior to installing extra python modules."
)
parser
.
add_option
(
"--without-pip"
,
default
=
False
,
action
=
"store_true"
,
help
=
"Do not install pip."
)
parser
.
set_defaults
(
unsign
=
True
)
options
,
_arguments
=
parser
.
parse_args
()
framework_path
=
get
.
FrameworkGetter
(
python_version
=
options
.
python_version
,
os_version
=
options
.
os_version
,
base_url
=
options
.
baseurl
,
).
download_and_extract
(
destination
=
options
.
destination
)
if
framework_path
:
files_relocatablized
=
relocatablize
(
framework_path
)
if
options
.
unsign
:
fix_broken_signatures
(
files_relocatablized
)
short_version
=
"."
.
join
(
options
.
python_version
.
split
(
"."
)[
0
:
2
])
install_extras
(
framework_path
,
version
=
short_version
,
requirements_file
=
options
.
pip_requirements
,
upgrade_pip
=
options
.
upgrade_pip
,
without_pip
=
options
.
without_pip
)
if
fix_other_things
(
framework_path
,
short_version
):
print
()
print
(
"Done!"
)
print
(
"Customized, relocatable framework is at %s"
%
framework_path
)
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL