mirror of
https://github.com/infeeeee/dyn2py
synced 2025-12-16 22:16:18 +01:00
Compare commits
6 Commits
2a6c42829f
...
5efae02594
| Author | SHA1 | Date | |
|---|---|---|---|
| 5efae02594 | |||
| 1eed4ed198 | |||
| 922765c7eb | |||
| 9a449b01fa | |||
| bfcab5f46d | |||
| 0c2174525e |
1
.github/workflows/unittests.yml
vendored
1
.github/workflows/unittests.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -7,7 +7,8 @@ AppPublisherURL=https://github.com/infeeeee/dyn2py
|
||||
AppSupportURL=https://github.com/infeeeee/dyn2py/issues
|
||||
AppUpdatesURL=https://github.com/infeeeee/dyn2py/releases/latest
|
||||
DefaultDirName={autopf}\dyn2py
|
||||
DisableProgramGroupPage=yes
|
||||
DisableProgramGroupPage=auto
|
||||
DefaultGroupName=dyn2py
|
||||
LicenseFile=LICENSE
|
||||
PrivilegesRequired=admin
|
||||
OutputBaseFilename=dyn2py-installer
|
||||
@@ -22,6 +23,9 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
[Files]
|
||||
Source: "dyn2py.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\dyn2py (cmd)"; Filename: "{cmd}"; WorkingDir: "{userdocs}"; Parameters: "/k dyn2py"
|
||||
Name: "{group}\dyn2py (powershell)"; Filename: "powershell"; WorkingDir: "{userdocs}"; Parameters: "-noexit -command dyn2py"
|
||||
|
||||
[Code]
|
||||
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
|
||||
|
||||
@@ -199,7 +199,10 @@ def run(options: Options) -> None:
|
||||
|
||||
elif f.is_python_file():
|
||||
logging.debug("Source is a Python file")
|
||||
try:
|
||||
f.update_dynamo(options)
|
||||
except FileNotFoundError:
|
||||
logging.error(f"Source Dynamo file not found! {f.filepath}")
|
||||
|
||||
# Write files at the end:
|
||||
for f in DynamoFile.open_files | PythonFile.open_files:
|
||||
|
||||
@@ -137,7 +137,7 @@ class File():
|
||||
# Create backup:
|
||||
if not options.dry_run and self.filepath.exists() and options.backup:
|
||||
backup_filename = sanitize_filename(
|
||||
f"{self.basename}_{self.mtimeiso}{self.extension}")
|
||||
filename=f"{self.basename}_{self.mtimeiso}{self.extension}")
|
||||
backup_path = self.dirpath.joinpath(backup_filename)
|
||||
logging.info(f"Creating backup to {backup_path}")
|
||||
self.filepath.rename(backup_path)
|
||||
@@ -410,10 +410,10 @@ class PythonFile(File):
|
||||
"Do not edit this section, if you want to update the Dynamo graph!"
|
||||
])
|
||||
|
||||
# Double escape path:
|
||||
dyn_path_string = str(dynamo_file.realpath)
|
||||
# Calculate relative path, change to forward slash
|
||||
dyn_path_string = os.path.relpath(dynamo_file.filepath, self.dirpath)
|
||||
if "\\" in dyn_path_string:
|
||||
dyn_path_string = dyn_path_string.replace("\\", "\\\\")
|
||||
dyn_path_string = dyn_path_string.replace("\\", "/")
|
||||
|
||||
self.header_data = {
|
||||
"dyn2py_version": METADATA["Version"],
|
||||
@@ -548,8 +548,16 @@ class PythonFile(File):
|
||||
# Open if it's the first time:
|
||||
if not dynamo_file:
|
||||
|
||||
dynamo_file = DynamoFile(
|
||||
pathlib.Path(self.header_data["dyn_path"]))
|
||||
cwd = pathlib.Path(os.getcwd()).resolve()
|
||||
# Change to pythonfiles' dir:
|
||||
os.chdir(self.dirpath)
|
||||
|
||||
dynpath = os.path.realpath(self.header_data["dyn_path"])
|
||||
logging.debug(f"Resolved path: {dynpath}")
|
||||
|
||||
# Change back to the original path:
|
||||
os.chdir(cwd)
|
||||
dynamo_file = DynamoFile(pathlib.Path(dynpath))
|
||||
|
||||
# Check if uuid is ok:
|
||||
if not dynamo_file.uuid == self.header_data["dyn_uuid"]:
|
||||
|
||||
Reference in New Issue
Block a user