Skip to content

Commit 3873343

Browse files
committed
Updata release process for pyproject.toml file
1 parent 4b104fd commit 3873343

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This should be sufficiant for a PR.
2121

2222
To open the browser project in that environment just call gitpod with your development fork url as argument.
2323

24-
`http://gitpod.io/#<your repo>`
24+
`http://gitpod.io/#<your repo>`
2525

2626
i.e. with the original repository: https://gitpod.io/#https://github.com/MarketSquare/robotframework-browser
2727

@@ -99,7 +99,7 @@ and Node components.
9999
```
100100
inv version $VERSION
101101
inv build
102-
git add Browser/version.py package.json package-lock.json setup.py docker/Dockerfile.latest_release
102+
git add Browser/version.py package.json package-lock.json pyproject.toml docker/Dockerfile.latest_release
103103
git commit -m "Update version to: $VERSION"
104104
git push
105105
```

tasks.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -859,23 +859,25 @@ def version(c, version):
859859
node_version_file = ROOT_DIR / "package.json"
860860
node_version_matcher = re.compile('"version": ".*"')
861861
_replace_version(node_version_file, node_version_matcher, f'"version": "{version}"')
862-
setup_py_file = ROOT_DIR / "setup.py"
863-
_replace_version(setup_py_file, node_version_matcher, f'"version": "{version}"')
864-
862+
package_lock = ROOT_DIR / "package-lock.json"
863+
data = json.loads(package_lock.read_text())
864+
data["version"] = version
865+
data["packages"][""]["version"] = version
866+
package_lock.write_text(json.dumps(data, indent=2))
867+
py_project_toml = ROOT_DIR / "pyproject.toml"
868+
py_project_toml_matcher = re.compile('version = ".*"')
869+
_replace_version(py_project_toml, py_project_toml_matcher, f'version = "{version}"', 1)
865870
dockerfile = ROOT_DIR / "docker" / "Dockerfile.latest_release"
866871
docker_version_matcher = re.compile("robotframework-browser==.*")
867872
_replace_version(
868873
dockerfile, docker_version_matcher, f"robotframework-browser=={version}"
869874
)
870-
# workflow_file = root_dir / ".github" / "workflows" / "python-package.yml"
871-
# workflow_version_matcher = re.compile("VERSION: .*")
872-
# _replace_version(workflow_file, workflow_version_matcher, f"VERSION: {version}")
873875

874876

875-
def _replace_version(filepath, matcher, version):
877+
def _replace_version(filepath, matcher, version, count=0):
876878
content = filepath.open().read()
877879
with open(filepath, "w") as out:
878-
out.write(matcher.sub(version, content))
880+
out.write(matcher.sub(version, content, count))
879881

880882

881883
@task

0 commit comments

Comments
 (0)