Skip to content

Commit

Permalink
Merge pull request #36 from home-assistant/dev
Browse files Browse the repository at this point in the history
Release 1.2
  • Loading branch information
pvizeli authored Aug 19, 2019
2 parents e3c0dd9 + be9b11a commit 8f9b0f7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
40 changes: 32 additions & 8 deletions builder/__main__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
"""Hass.io Builder main application."""
import sys
from pathlib import Path
import shutil
from subprocess import CalledProcessError
import sys
from tempfile import TemporaryDirectory
from typing import Optional

import click
import click_pathlib

from builder.apk import install_apks
from builder.infra import create_wheels_folder, create_wheels_index
from builder.pip import (
build_wheels_local,
build_wheels_package,
build_wheels_requirement,
build_wheels_local,
write_requirement,
extract_packages,
write_requirement,
)
from builder.upload import run_upload
from builder.utils import check_url, fix_wheels_name
Expand All @@ -28,15 +30,16 @@
type=click_pathlib.Path(exists=True),
help="Python requirement file.",
)
@click.option("--upload", default="rsync", help="Upload plugin to upload wheels.")
@click.option(
"--remote", required=True, type=str, help="Remote URL pass to upload plugin."
)
@click.option(
"--requirement-diff",
type=click_pathlib.Path(exists=True),
help="Python requirement file to calc the different for selective builds.",
)
@click.option(
"--prebuild-dir",
type=click_pathlib.Path(exists=True),
help="Folder with include allready builded wheels for upload.",
)
@click.option(
"--single",
is_flag=True,
Expand All @@ -46,7 +49,21 @@
@click.option(
"--local", is_flag=True, default=False, help="Build wheel from local folder setup."
)
def builder(apk, index, requirement, upload, remote, requirement_diff, single, local):
@click.option("--upload", default="rsync", help="Upload plugin to upload wheels.")
@click.option(
"--remote", required=True, type=str, help="Remote URL pass to upload plugin."
)
def builder(
apk: str,
index: str,
requirement: Optional[Path],
requirement_diff: Optional[Path],
prebuild_dir: Optional[Path],
single: bool,
local: bool,
upload: str,
remote: str,
):
"""Build wheels precompiled for Home Assistant container."""
install_apks(apk)
check_url(index)
Expand All @@ -59,8 +76,14 @@ def builder(apk, index, requirement, upload, remote, requirement_diff, single, l
wheels_index = create_wheels_index(index)

if local:
# Build wheels in a local folder/src
build_wheels_local(wheels_index, wheels_dir)
elif prebuild_dir:
# Prepare allready builded wheels for upload
for whl_file in prebuild_dir.glob("*.whl"):
shutil.copy(whl_file, Path(wheels_dir, whl_file.name))
elif single:
# Build every wheel like a single installation
packages = extract_packages(requirement, requirement_diff)
for package in packages:
print(f"Process package: {package}", flush=True)
Expand All @@ -69,6 +92,7 @@ def builder(apk, index, requirement, upload, remote, requirement_diff, single, l
except CalledProcessError:
exit_code = 109
else:
# Build all needed wheels at once
packages = extract_packages(requirement, requirement_diff)
temp_requirement = Path("/tmp/wheels_requirement.txt")
write_requirement(temp_requirement, packages)
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
click==7.0
click-pathlib==2019.6.13.1
requests==2.22.0
Cython==0.29.12
wheel==0.33.4
Cython==0.29.13
wheel==0.33.6
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

VERSION = "1.1"
VERSION = "1.2"

setup(
name="builder",
Expand Down

0 comments on commit 8f9b0f7

Please sign in to comment.