Skip to content

Commit

Permalink
add(py-version): add build parameter for py version
Browse files Browse the repository at this point in the history
  • Loading branch information
YoEnte committed Jan 16, 2025
1 parent 9fea74e commit 4bae8f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion python/socha/starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
directory: str = None,
architecture: str = None,
log_level: int = logging.INFO,
python_version: str = '3.10',
):
"""
All these arguments can be overwritten, when parsed via start arguments,
Expand Down Expand Up @@ -71,8 +72,9 @@ def __init__(
self.directory: str = args.directory or directory
self.architecture: str = args.architecture or architecture
self.build: str = args.build or build
self.python_version: str = args.python_version or python_version
if self.build:
builder = SochaPackageBuilder(self.directory, self.architecture)
builder = SochaPackageBuilder(self.directory, self.architecture, self.python_version)
builder.build_package()
exit(0)

Expand Down Expand Up @@ -242,4 +244,9 @@ def _handle_start_args():
help="Specifies the build architecture (e.g.: manylinux1_x86_64).",
)

parser.add_argument(
"--python-version",
help="Specifies the build python version (e.g.: 10 [for python 3.10 - this is standard]).",
)

return parser.parse_args()
5 changes: 3 additions & 2 deletions python/socha/utils/package_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

class SochaPackageBuilder:

def __init__(self, package_name, architecture):
def __init__(self, package_name, architecture, python_version):
self.package_name = package_name
self.architecture = architecture
self.python_version = python_version
self.dependencies_dir = "dependencies"
self.packages_dir = "packages"
self.cache_dir = ".pip_cache"
Expand Down Expand Up @@ -50,7 +51,7 @@ def _download_dependencies(self):
"download",
f"--platform={self.architecture}",
"--python-version",
"3.10",
f"{self.python_version}",
"--only-binary=:all:",
"-d",
f"{self.build_dir}/{self.package_name}/{self.dependencies_dir}",
Expand Down

0 comments on commit 4bae8f1

Please sign in to comment.