Skip to content

Commit 28814d4

Browse files
test
1 parent df671b2 commit 28814d4

File tree

3 files changed

+248
-193
lines changed

3 files changed

+248
-193
lines changed
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2025 Intel Corporation
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS,
8+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
# See the License for the specific language governing permissions and
10+
# limitations under the License.
11+
12+
import re
13+
import sys
14+
from pathlib import Path
15+
16+
CONSTRAINTS_FILE = "constraints.txt"
17+
18+
19+
def main():
20+
arg = sys.argv[1]
21+
overrided_requirements = [r.strip() for r in arg.split(",")]
22+
23+
print("overrided_requirements: ", arg)
24+
25+
file = Path(CONSTRAINTS_FILE)
26+
content = file.read_text()
27+
28+
for new_requirement in overrided_requirements:
29+
new_requirement = new_requirement.strip()
30+
package_name = new_requirement.split("==")[0]
31+
content = re.sub(f"^{package_name}\s*[=><].*", "", content, flags=re.MULTILINE)
32+
content += f"\n{new_requirement}"
33+
34+
print("New constraints:")
35+
print(content)
36+
37+
file.write_text(content)
38+
39+
40+
if __name__ == "__main__":
41+
main()

0 commit comments

Comments
 (0)