FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-feedstock/python-3.11/brand_python.py at main · cdeepali/python-feedstock · GitHub
cdeepali
/
python-feedstock
Public
forked from
open-ce/python-feedstock
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-feedstock
/
python-3.11
/
brand_python.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (31 loc) · 1.19 KB
Breadcrumbs
python-feedstock
/
python-3.11
/
brand_python.py
Copy path
File metadata and controls
41 lines (31 loc) · 1.19 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
import
argparse
import
os
import
re
platform_file
=
os
.
path
.
join
(
'Lib'
,
'platform.py'
)
get_version_file
=
os
.
path
.
join
(
'Python'
,
'getversion.c'
)
def
patch_platform
(
msg
):
with
open
(
platform_file
,
'r'
)
as
fh
:
lines
=
list
(
fh
)
lines_it
=
iter
(
lines
)
with
open
(
platform_file
,
'w'
)
as
fh
:
for
line
in
lines_it
:
fh
.
write
(
line
)
if
line
.
startswith
(
'_sys_version_parser'
):
next_line
=
next
(
lines_it
)
fh
.
write
(
" r'([\w.+]+)\s*"
+
'(?:'
+
re
.
escape
(
' '
+
msg
)
+
')?'
+
"\s*'
\n
"
)
def
patch_get_version
(
msg
):
with
open
(
get_version_file
,
'r'
)
as
fh
:
content
=
list
(
fh
)
lines
=
iter
(
content
)
with
open
(
get_version_file
,
'w'
)
as
fh
:
for
line
in
lines
:
if
line
.
strip
().
startswith
(
'PyOS_snprintf(version, sizeof(version)'
):
fh
.
write
(
' PyOS_snprintf(version, sizeof(version),
\n
'
)
fh
.
write
(
' "%.80s '
+
msg
.
replace
(
'"'
,
'
\\
"'
)
+
' (%.80s) %.80s",
\n
'
)
else
:
fh
.
write
(
line
)
msg
=
os
.
environ
.
get
(
'python_branding'
,
'<undefined>'
)
if
msg
==
'<undefined>'
:
msg
=
"| packaged by IBM |"
patch_platform
(
msg
)
patch_get_version
(
msg
)
Back
|
FazBrowse Home
|
New Git URL