Untitled
unknown
plain_text
2 years ago
1.1 kB
7
Indexable
import os
import subprocess
def change_nuget_config(module_path, job_conf, is_dev):
try:
nuget_config_path = module_path
if job_conf.get("nuget_config_path"):
nuget_config_path += job_conf["nuget_config_path"]
nuget_config = os.listdir(nuget_config_path)
nuget_config = [file for file in nuget_config if file.lower() == "nuget.config"]
if nuget_config:
nuget_config = nuget_config[0]
else:
raise FileNotFoundError
except FileNotFoundError:
print("nuget not found")
nuget_config = "nuget.config"
module_path = module_path.replace(" ", "\\ ")
nuget_file = os.path.join(module_path, nuget_config)
print("Path is:", module_path, "nugetFile:", nuget_file)
if os.path.exists(nuget_file):
os.remove(nuget_file)
if is_dev:
subprocess.run(["cp", "-f", f"{CI_HOME}/common/nuget.dev.config", nuget_file], check=True)
else:
subprocess.run(["cp", "-f", f"{CI_HOME}/common/nuget.config", nuget_file], check=True)
Editor is loading...
Leave a Comment