-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lint Python scripts and add GitHub Action (#232)
* Sort imports using isort * Lint python files with black * Add GitHub action for linting Python files * Add lint packages to requirements.txt * Add lint badges to readme * Document linting for Python in CONTRIBUTING.md * Fix file
- Loading branch information
1 parent
2d8712b
commit b0c15e1
Showing
12 changed files
with
568 additions
and
326 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
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
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
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
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 |
---|---|---|
@@ -1,36 +1,45 @@ | ||
import os, sys, json | ||
import json | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
sys.path.append(sys.argv[1]) | ||
|
||
from build_project import execute | ||
|
||
with open("addons/silicon.util.gdnative_helper/build_config.json", 'r') as config: | ||
args = json.load(config) | ||
args["library_name"] = sys.argv[2] | ||
args["target_file_path"] = sys.argv[3] | ||
args["source_path"] = sys.argv[4] | ||
args["library_extension"] = sys.argv[5] | ||
args["platform"] = sys.argv[6] | ||
args["arch"] = sys.argv[7] | ||
args["target"] = sys.argv[8] | ||
args["gd_settings_dir"] = str(Path(sys.argv[1], "../..").resolve()) | ||
with open("addons/silicon.util.gdnative_helper/build_config.json", "r") as config: | ||
args = json.load(config) | ||
args["library_name"] = sys.argv[2] | ||
args["target_file_path"] = sys.argv[3] | ||
args["source_path"] = sys.argv[4] | ||
args["library_extension"] = sys.argv[5] | ||
args["platform"] = sys.argv[6] | ||
args["arch"] = sys.argv[7] | ||
args["target"] = sys.argv[8] | ||
args["gd_settings_dir"] = str(Path(sys.argv[1], "../..").resolve()) | ||
|
||
os.chdir(sys.argv[1]) | ||
os.chdir(sys.argv[1]) | ||
|
||
# Get older dll out of the way on Windows. | ||
lib_name = "%s.%s" % (args["target_file_path"], args["library_extension"]) | ||
try: | ||
if os.path.exists(lib_name) and args["platform"] == "windows" and os.name == "nt": | ||
# if os.path.exists(lib_name + ".old"): | ||
# os.remove(lib_name + ".old") | ||
os.replace(lib_name, lib_name + ".old") | ||
except OSError as e: | ||
raise OSError("Cannot delete Windows DLL at \"%s\"! Please delete it manually." % lib_name) | ||
# Get older dll out of the way on Windows. | ||
lib_name = "%s.%s" % (args["target_file_path"], args["library_extension"]) | ||
try: | ||
if ( | ||
os.path.exists(lib_name) | ||
and args["platform"] == "windows" | ||
and os.name == "nt" | ||
): | ||
# if os.path.exists(lib_name + ".old"): | ||
# os.remove(lib_name + ".old") | ||
os.replace(lib_name, lib_name + ".old") | ||
except OSError as e: | ||
raise OSError( | ||
'Cannot delete Windows DLL at "%s"! Please delete it manually.' % lib_name | ||
) | ||
|
||
# Create directory for library files to reside | ||
try: | ||
os.makedirs(Path(args["target_file_path"]).parent) | ||
except: pass | ||
# Create directory for library files to reside | ||
try: | ||
os.makedirs(Path(args["target_file_path"]).parent) | ||
except: | ||
pass | ||
|
||
execute(args) | ||
execute(args) |
Oops, something went wrong.