Download and extract files in wheel scripts dir
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This avoids conflicting file names with the root cwd
This commit is contained in:
parent
75c37b4aa7
commit
e58f1fd7b1
@ -10,6 +10,7 @@ from pathlib import Path
|
|||||||
from shutil import copy
|
from shutil import copy
|
||||||
from shutil import copytree
|
from shutil import copytree
|
||||||
from shutil import move
|
from shutil import move
|
||||||
|
from subprocess import check_call
|
||||||
|
|
||||||
import toml
|
import toml
|
||||||
from wheel.wheelfile import WheelFile
|
from wheel.wheelfile import WheelFile
|
||||||
@ -39,7 +40,7 @@ class Config:
|
|||||||
include_extra_files: list[str] | None = None
|
include_extra_files: list[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
def download(config: Config) -> list[Path]:
|
def download(config: Config, wheel_scripts: Path) -> list[Path]:
|
||||||
release = rg.fetch_release(
|
release = rg.fetch_release(
|
||||||
rg.GitRemoteInfo(config.hostname, config.owner, config.repo), config.version
|
rg.GitRemoteInfo(config.hostname, config.owner, config.repo), config.version
|
||||||
)
|
)
|
||||||
@ -51,11 +52,13 @@ def download(config: Config) -> list[Path]:
|
|||||||
arch_mapping=config.map_arch,
|
arch_mapping=config.map_arch,
|
||||||
)
|
)
|
||||||
|
|
||||||
files = rg.download_asset(asset, extract_files=config.extract_files)
|
files = rg.download_asset(
|
||||||
|
asset, extract_files=config.extract_files, destination=wheel_scripts
|
||||||
|
)
|
||||||
|
|
||||||
# Optionally execute post command
|
# Optionally execute post command
|
||||||
if config.exec:
|
if config.exec:
|
||||||
rg.check_call(config.exec, shell=True)
|
check_call(config.exec, shell=True, cwd=wheel_scripts)
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
||||||
@ -160,9 +163,7 @@ class _PseudoBuildBackend:
|
|||||||
copytree(metadata_directory, wheel_directory / metadata_directory.name)
|
copytree(metadata_directory, wheel_directory / metadata_directory.name)
|
||||||
|
|
||||||
metadata = read_metadata()
|
metadata = read_metadata()
|
||||||
files = download(metadata)
|
download(metadata, wheel_scripts)
|
||||||
for file in files:
|
|
||||||
move(file, wheel_scripts / file.name)
|
|
||||||
|
|
||||||
for file_name in metadata.include_extra_files or []:
|
for file_name in metadata.include_extra_files or []:
|
||||||
file = Path(file_name)
|
file = Path(file_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user