diff --git a/README.md b/README.md index 0195175..8f73ddd 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,8 @@ you can of course pass start arguments. | **-v, --verbose** | Verbose option for logging. | | **--auto-reconnect** | Automatically reconnect to the server if the connection is lost. | | **-b, --build** | Builds this script into a package with all its dependencies. | +| **-d, --directory** | The directory where the package should be built. | +| **-a, --architecture**| The architecture of the package. | ## Preparing Your Player for the Competition @@ -182,7 +184,7 @@ because the system will run on a docker container without access to the internet > All you need is a `requirements.txt` file that lists all your dependencies. > To start, simply run the following command in your terminal: > -> `$ python .py --build ` +> `$ python .py --build -directory -architecture ` > > This will trigger the package to do its magic and build your project. diff --git a/pyproject.toml b/pyproject.toml index 7803a29..b4e46f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "maturin" name = "socha" version = "2.2.1" authors = [{ name = "maxblan", email = "stu222782@mail.uni-kiel.de" }] -description = "This is the package for the Software-Challenge Germany 2023. This Season the game will be 'Hey, danke für den Fisch' a.k.a. 'Penguins' in short." +description = "This is the package for the Software-Challenge Germany 2024. This Season the game will be 'Mississippi Queen'." readme = "README.md" requires-python = ">=3.10" dependencies = ["xsdata==22.9"] diff --git a/python/socha/starter.py b/python/socha/starter.py index 7dd0076..af4d344 100644 --- a/python/socha/starter.py +++ b/python/socha/starter.py @@ -33,7 +33,9 @@ def __init__( headless: bool = False, log: bool = False, verbose: bool = False, - build: str = None, + build: bool = False, + directory: str = None, + architecture: str = None, log_level: int = logging.INFO, ): """ @@ -66,9 +68,11 @@ def __init__( self.check_socha_version() + self.directory: str = args.directory or directory + self.architecture: str = args.architecture or architecture self.build: str = args.build or build if self.build: - builder = SochaPackageBuilder(self.build) + builder = SochaPackageBuilder(self.directory, self.architecture) builder.build_package() exit(0) @@ -222,6 +226,20 @@ def _handle_start_args(): parser.add_argument( "-b", "--build", + action="store_true", help="Builds the this script into a package with all its dependencies.", ) + + parser.add_argument( + "-d", + "--directory", + help="Specifies the name of the directory for the build package.", + ) + + parser.add_argument( + "-a", + "--architecture", + help="Specifies the build architecture (e.g.: manylinux1_x86_64).", + ) + return parser.parse_args() diff --git a/python/socha/utils/package_builder.py b/python/socha/utils/package_builder.py index 2ae409b..dfcdc32 100644 --- a/python/socha/utils/package_builder.py +++ b/python/socha/utils/package_builder.py @@ -14,8 +14,9 @@ class SochaPackageBuilder: - def __init__(self, package_name): + def __init__(self, package_name, architecture): self.package_name = package_name + self.architecture = architecture self.dependencies_dir = "dependencies" self.packages_dir = "packages" self.cache_dir = ".pip_cache" @@ -47,6 +48,7 @@ def _download_dependencies(self): "-m", "pip", "download", + f"--platform={self.architecture}", "--only-binary=:all:", "-d", f"{self.build_dir}/{self.package_name}/{self.dependencies_dir}",