-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4a2e77
commit b44cea9
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import subprocess | ||
import os | ||
|
||
os.system("ls -a") | ||
tag = subprocess.check_output("git describe --tags", shell=True, encoding="UTF-8") | ||
|
||
print("[TAG MARKER] git response: " + tag) | ||
tag = tag.replace("\n", "").replace("v", "") | ||
if tag.find("-") > 1: | ||
tag = tag[0:tag.find("-")] | ||
print("[TAG MARKER] FOUND TAG: " + tag) | ||
|
||
print("[TAG MARKER] MARKING VERSION IN pyproject.toml") | ||
# Open the file for reading and writing (the 'r+' mode provides both read and write access) | ||
with open('pyproject.toml', 'r+') as file: | ||
# Reading the contents of a file | ||
content = file.read() | ||
# Replace the desired part of the text using the replace method | ||
new_content = content.replace('!!{PLACEHOLDER}!!', tag) | ||
# Move the file pointer to the beginning (0) to overwrite | ||
file.seek(0) | ||
# Write the changed content back to the file | ||
file.write(new_content) | ||
# Trim the file if the new content is shorter than the old one to remove the remaining data | ||
file.truncate() | ||
print("[TAG MARKER] DONE") | ||
|
||
print("[TAG MARKER] MARKING VERSION IN src/clipman/__version__.py") | ||
with open('src/clipman/__version__.py', 'r+') as file: | ||
# Reading the contents of a file | ||
content = file.read() | ||
# Replace the desired part of the text using the replace method | ||
new_content = content.replace('!!{PLACEHOLDER}!!', tag) | ||
# Move the file pointer to the beginning (0) to overwrite | ||
file.seek(0) | ||
# Write the changed content back to the file | ||
file.write(new_content) | ||
# Trim the file if the new content is shorter than the old one to remove the remaining data | ||
file.truncate() | ||
print("[TAG MARKER] DONE") | ||
|
||
print("[TAG MARKER] Work finished") |