Skip to content

Commit e19082b

Browse files
committed
Rename Distribution Package
This will be the project name on PyPI.
1 parent 5544cb3 commit e19082b

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ jobs:
102102
with:
103103
path: 'src/.github/'
104104

105-
- name: Overwrite README for PyPI
106-
run: cp src/.github/README.md src/
105+
- name: Overwrite README & Distribution Package for PyPI
106+
run: |
107+
cp src/.github/README.md src/
108+
python src/.github/rename_package.py src/setup.py
107109
108110
- uses: actions/setup-python@v5
109111
name: Install Python

rename_package.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright 2021-2025 The ImpactX Community
4+
#
5+
# Authors: Axel Huebl
6+
# License: BSD-3-Clause-LBNL
7+
#
8+
import re
9+
import sys
10+
11+
12+
find = r'name="impactx",'
13+
replace = r'name="impactx-noacc",'
14+
15+
16+
if len(sys.argv) == 2:
17+
file_path = sys.argv[1]
18+
else:
19+
print("Must pass path to setup.py as first argument!")
20+
sys.exit(1)
21+
22+
new_content = ""
23+
with open(file_path, "r") as file:
24+
for line in file.readlines():
25+
if re.search(find, line):
26+
new_content += re.sub(find, replace, line)
27+
else:
28+
new_content += line # Keep original line
29+
30+
with open(file_path, "w") as file:
31+
file.write(new_content)

0 commit comments

Comments
 (0)