Skip to content

Commit

Permalink
1.1.0 Release Build (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhar authored Jun 18, 2024
2 parents 5253234 + 9038f0f commit 4a2305e
Show file tree
Hide file tree
Showing 238 changed files with 48,420 additions and 2,404 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 117 additions & 0 deletions Phakager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import argparse
import json
import os

from packager import ManifestVersion


PACKAGE_NAME = "PharAPSM64"
PACKAGES_PATH = os.path.join(os.getcwd(), "packs")
PACK_ROOT_PATH = os.path.join(os.getcwd(), "pack_root")
EXTERNAL_INCLUDES = ["LICENSE"]

parser = argparse.ArgumentParser(
"python ./Phakager.py", description="A CLI package builder and compiler for PopTracker packs."
)

parser.add_argument(
"-c",
"--compile",
help="runs compilation code for auto-generated json files for tracker",
action="store_true",
)
parser.add_argument(
"-k",
"--package",
help="gathers all relevant files and zips them into packs directory",
action="store_true",
)
parser.add_argument(
"-i",
"--increment_major",
help="increments the major component in the manifest file",
action="store_true",
)
parser.add_argument(
"-m",
"--increment_minor",
help="increments the minor component in the manifest file",
action="store_true",
)
parser.add_argument(
"-p",
"--increment_patch",
help="increments the build component in the manifest file",
action="store_true",
)
parser.add_argument(
"-d",
"--mark_dev",
help="marks current manifest as developer build with timestamp of build",
action="store_true",
)


if __name__ == "__main__":
import sys
import time

start_time = time.perf_counter()

# Display '--help', if no args provided.
if len(sys.argv) < 2:
parser.print_help()
exit(0)

# Load Manifest and Version
with open(os.path.join(PACK_ROOT_PATH, "manifest.json"), "r", encoding="utf-8") as manifest_file:
manifest: dict[str, any] = json.loads(manifest_file.read())
version: ManifestVersion = ManifestVersion.parse_version(manifest["package_version"])

# Handle Version Updating
args = parser.parse_args()
if args.increment_patch:
version = version.increment_patch()
if args.increment_minor:
version = version.increment_minor()
if args.increment_major:
version = version.increment_major()
if args.mark_dev:
version = version.mark_development()
else:
version = version.clear_development()

if version.__str__() != manifest["package_version"]:
print(f"[Phakager] Updating manifest version from {manifest["package_version"]} -> {version}")
manifest["package_version"] = version.__str__()
with open(os.path.join(PACK_ROOT_PATH, "manifest.json"), "w", encoding="utf-8") as manifest_file:
json.dump(manifest, manifest_file, indent=4)

# Handle Compilation
if args.compile:
from packager.compile import compile_all

print("[Phakager] Compiling all files...")
compile_all()

# Handle Packaging
if args.package:
from zipfile import ZipFile

print("[Phakager] Packaging all files...")
os.makedirs(PACKAGES_PATH, exist_ok=True)
pack_path = os.path.join(PACKAGES_PATH, f"{PACKAGE_NAME}_{version}.zip")
with ZipFile(pack_path, "w") as pack:
for root, dirs, files in os.walk(PACK_ROOT_PATH):
for file in files:
file_path = os.path.join(root, file)
pack.write(file_path, os.path.relpath(os.path.join(root, file), PACK_ROOT_PATH))

for file in EXTERNAL_INCLUDES:
file_path = os.path.join(os.getcwd(), file)
pack.write(file_path, file)

print(f"[Phakager] Completed packaging {PACKAGE_NAME}_{version}.zip")

end_time = time.perf_counter()
print(f"[Phakager] Finished processing in {round(end_time - start_time, 2)} secs. Enjoy!")
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ This is a [PopTracker](https://poptracker.github.io/) pack for the **Archipelago
- Automatically enables Area Randomization, if enabled.
- Automatically displays required star requirements for doors and MIPS.
- Automatically displays required goal requirement.
- Automatically toggles 100 Coin Stars if enabled/disabled.
- Handles progressive and non-progressive keys automatically.

## Planned Features

- Auto-Tracking Settings for 100 Coins, Bob-omb Buddies, amd 1-Up Blocks
- Auto-Tracking Settings for Bob-omb Buddies and 1-Up Blocks
- Auto-Tracking Area Randomization if Entrance is Accessible
- ~~Basically working, but needs to be hidden behind a "spoiler" flag.~~
- Additional Maps for each Course and Secret Area.
- _Potentially more..._

Expand Down
210 changes: 0 additions & 210 deletions compile.py

This file was deleted.

Binary file modified docs/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4a2305e

Please sign in to comment.