Coding style.
- pydoc expects scripts that do little when imported. So all python scripts really need 'if __name__ == "__main__":'
This commit is contained in:
parent
aea93874cc
commit
07a73e006c
3 changed files with 69 additions and 56 deletions
|
|
@ -20,11 +20,6 @@ The script should only be run from the root of the local eris repository.
|
|||
"""
|
||||
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
print(USAGE)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def patch_manifest(manifest_path, patched_manifest_path):
|
||||
with open(manifest_path) as manifest_file:
|
||||
manifest = json.load(manifest_file)
|
||||
|
|
@ -34,12 +29,21 @@ def patch_manifest(manifest_path, patched_manifest_path):
|
|||
json.dump(manifest, patched_manifest_file, indent=2)
|
||||
|
||||
|
||||
manifest_path, build_dir, state_dir = sys.argv[1:4]
|
||||
def main(argv):
|
||||
if len(argv) != 4:
|
||||
print(USAGE)
|
||||
sys.exit(1)
|
||||
manifest_path, build_dir, state_dir = argv[1:4]
|
||||
patched_manifest_path = "manifests-cache/patched-manifest.json"
|
||||
patch_manifest(manifest_path, patched_manifest_path)
|
||||
subprocess.run(["flatpak-builder", build_dir, patched_manifest_path,
|
||||
"--force-clean", "--state-dir", state_dir, "--disable-updates"],
|
||||
check=True)
|
||||
"--force-clean", "--state-dir", state_dir,
|
||||
"--disable-updates"], check=True)
|
||||
subprocess.run(["flatpak", "build", build_dir, "test-all"], check=True)
|
||||
subprocess.run(["flatpak", "build", build_dir, "eris", "--help"], check=True)
|
||||
subprocess.run(["flatpak", "build", build_dir, "eris", "--help"],
|
||||
check=True)
|
||||
print("Build successful:", build_dir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ def make_combined_manifest(all_modules):
|
|||
SUBSTITUTIONS = {"shellcheck": "haskell/ShellCheck",
|
||||
"pandoc": "haskell/pandoc"}
|
||||
|
||||
|
||||
def main():
|
||||
manifests_dir = os.path.join(os.getcwd(), "manifests-cache")
|
||||
os.makedirs(manifests_dir, exist_ok=True)
|
||||
deps = {SUBSTITUTIONS.get(dep, dep) for dep in eris.tools.dependencies()}
|
||||
|
|
@ -473,3 +473,7 @@ manifest_path = "com.github.ahamilton.eris.json"
|
|||
print()
|
||||
print(f"Saving manifest file: ./{manifest_path}")
|
||||
save_manifest(manifest, manifest_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ def tool_markup(tool):
|
|||
return (tool.__name__ if url is None else f"[{tool.__name__}]({url})")
|
||||
|
||||
|
||||
def main():
|
||||
all_tools = ([(["*"], tools.generic_tools() +
|
||||
[tools.git_blame, tools.git_log])] +
|
||||
tools.TOOLS_FOR_EXTENSIONS)
|
||||
|
|
@ -52,3 +53,7 @@ Extensions({len(extension_set)-1}) | Tools({len(tool_set)})
|
|||
for extensions, tools_ in all_tools:
|
||||
print("%s | %s" % (" ".join("." + extension for extension in extensions),
|
||||
" • ".join(tool_markup(tool) for tool in tools_)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue