Skip to content

Commit 7c9f1c1

Browse files
test
1 parent df671b2 commit 7c9f1c1

File tree

5 files changed

+291
-218
lines changed

5 files changed

+291
-218
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Override Constraints'
2+
description: ''
3+
4+
inputs:
5+
override_requirements:
6+
description: 'Override requirements'
7+
default: ''
8+
type: string
9+
required: false
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- run: python .github/actions/override_constraints/action.yml "${{ inputs.override_requirements }}"
15+
if: ${{ inputs.override_requirements != '' }}
16+
shell: bash
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)