FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
setup-python/.github/scripts/create_python_matrix.py at master · MatteoH2O1999/setup-python · GitHub
MatteoH2O1999
setup-python
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
setup-python
/
.github
/
scripts
/
create_python_matrix.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (26 loc) · 1.16 KB
Breadcrumbs
setup-python
/
.github
/
scripts
/
create_python_matrix.py
Copy path
File metadata and controls
30 lines (26 loc) · 1.16 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
import
git
import
json
import
os
import
sys
import
tempfile
json_dict
=
{
"os"
: [
"ubuntu-latest"
,
"windows-latest"
,
"macos-latest"
],
"python-version"
: []}
if
sys
.
argv
[
1
]
==
'true'
:
json_dict
[
'cache'
]
=
[
False
,
True
]
with
tempfile
.
TemporaryDirectory
()
as
temp_dir
:
python_repo
=
git
.
Repo
.
clone_from
(
'https://github.com/python/cpython.git'
,
temp_dir
)
tags
=
python_repo
.
tags
for
tag
in
tags
:
if
not
any
(
substring
in
tag
.
name
for
substring
in
[
'a'
,
'b'
,
'c'
,
'rc'
,
'-'
]):
if
tag
.
name
.
count
(
'v'
)
>
0
:
short_tag
=
tag
.
name
.
replace
(
'v'
,
''
)
while
short_tag
.
count
(
'.'
)
>
1
:
short_tag
=
short_tag
[:
-
1
]
splits
=
short_tag
.
split
(
'.'
)
major
=
int
(
splits
[
0
])
minor
=
int
(
splits
[
1
])
if
major
==
3
and
minor
>=
8
and
short_tag
not
in
json_dict
[
'python-version'
]:
json_dict
[
'python-version'
].
append
(
short_tag
)
if
minor
>=
13
:
json_dict
[
'python-version'
].
append
(
f"
{
short_tag
}
t"
)
with
open
(
os
.
environ
[
'GITHUB_OUTPUT'
],
'a'
)
as
fh
:
print
(
f'matrix=
{
json
.
dumps
(
json_dict
)
}
'
,
file
=
fh
)
Back
|
FazBrowse Home
|
New Git URL