|
@@ -20,7 +20,7 @@ from pathlib import Path
|
|
|
import toml # type: ignore
|
|
|
|
|
|
|
|
|
-def get_requirements(pkg: str):
|
|
|
+def get_requirements(pkg: str, env: str = "dev") -> list:
|
|
|
# get requirements from the different setups in tools/packages (removing taipy packages)
|
|
|
reqs = set()
|
|
|
pkg_name = pkg if pkg == "taipy" else f"taipy-{pkg}"
|
|
@@ -29,10 +29,12 @@ def get_requirements(pkg: str):
|
|
|
requirements_file = os.path.join(package_path, "setup.requirements.txt")
|
|
|
if os.path.exists(requirements_file):
|
|
|
reqs.update(Path(requirements_file).read_text("UTF-8").splitlines())
|
|
|
- return [r for r in reqs if r and not r.startswith("taipy")]
|
|
|
+ if env == "dev":
|
|
|
+ return [r for r in reqs if r and not r.startswith("taipy")]
|
|
|
+ return list(reqs)
|
|
|
|
|
|
|
|
|
-def update_pyproject(version_path: str, pyproject_path: str):
|
|
|
+def update_pyproject(version_path: str, pyproject_path: str, env: str = "dev"):
|
|
|
with open(version_path) as version_file:
|
|
|
version = json.load(version_file)
|
|
|
version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
|
|
@@ -42,9 +44,9 @@ def update_pyproject(version_path: str, pyproject_path: str):
|
|
|
pyproject_data = toml.load(pyproject_path)
|
|
|
pyproject_data["project"]["version"] = version_string
|
|
|
pyproject_data["project"]["urls"]["Release notes"] = f"https://docs.taipy.io/en/release-{version_string}/relnotes/"
|
|
|
- pyproject_data["project"]["dependencies"] = get_requirements(get_pkg_name(pyproject_path))
|
|
|
+ pyproject_data["project"]["dependencies"] = get_requirements(get_pkg_name(pyproject_path), env)
|
|
|
|
|
|
- with open(pyproject_path, "w") as pyproject_file:
|
|
|
+ with open(pyproject_path, "w", encoding="utf-8") as pyproject_file:
|
|
|
toml.dump(pyproject_data, pyproject_file)
|
|
|
|
|
|
|
|
@@ -57,7 +59,7 @@ def _build_webapp(webapp_path: str):
|
|
|
|
|
|
def get_pkg_name(path: str) -> str:
|
|
|
# The regex pattern
|
|
|
- pattern = r"([^/]+)/pyproject\.toml$"
|
|
|
+ pattern = r"([^/\\]+)[/\\]pyproject\.toml$"
|
|
|
|
|
|
# Search for the pattern
|
|
|
match = re.search(pattern, os.path.abspath(path))
|
|
@@ -67,17 +69,21 @@ def get_pkg_name(path: str) -> str:
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- _pyproject_path = f"{sys.argv[1]}/pyproject.toml"
|
|
|
+ _pyproject_path = os.path.join(sys.argv[1], "pyproject.toml")
|
|
|
+ try:
|
|
|
+ env = sys.argv[2]
|
|
|
+ except IndexError:
|
|
|
+ env = "dev"
|
|
|
|
|
|
pkg = get_pkg_name(_pyproject_path)
|
|
|
if pkg == "taipy":
|
|
|
- _version_path = f"{sys.argv[1]}/taipy/version.json"
|
|
|
- _webapp_path = f"{sys.argv[1]}/taipy/gui/webapp/index.html"
|
|
|
+ _version_path = os.path.join(sys.argv[1], "taipy", "version.json")
|
|
|
+ _webapp_path = os.path.join(sys.argv[1], "taipy", "gui", "webapp", "index.html")
|
|
|
else:
|
|
|
- _version_path = f"{sys.argv[1]}/version.json"
|
|
|
- _webapp_path = f"{sys.argv[1]}/webapp/index.html"
|
|
|
+ _version_path = os.path.join(sys.argv[1], "version.json")
|
|
|
+ _webapp_path = os.path.join(sys.argv[1], "webapp", "index.html")
|
|
|
|
|
|
- update_pyproject(_version_path, _pyproject_path)
|
|
|
+ update_pyproject(_version_path, _pyproject_path, env)
|
|
|
|
|
|
if pkg == "gui":
|
|
|
_build_webapp(_webapp_path)
|