Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli committed Apr 30, 2019
0 parents commit 59545b6
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# pylint
.pylint.d/

# VS Code
.vscode/
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG BUILD_FROM
FROM BUILD_FROM

# Install requirements
COPY requirements.txt /usr/src/
RUN apk add --no-cache --virtual .build-dependencies \
make \
g++ \
openssl-dev \
libffi-dev \
musl-dev \
&& export MAKEFLAGS="-j$(nproc)" \
&& pip3 install --no-cache-dir -r /usr/src/requirements.txt \
&& apk del .build-dependencies \
&& rm -f /usr/src/requirements.txt

# Install builder
COPY . /usr/src/builder/
RUN apk add --no-cache /usr/src/builder \
&& rm -fr /usr/src/builder

WORKDIR /data
CMD [ "python3", "-m", "builder" ]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Hass.io Wheels builder

## Supported file transfer

- rsync

## Config

```
[builder]
upload=rsync
index=https://xxxx/
requirements=
requirements_all.txt
[rsync]
path=
```
1 change: 1 addition & 0 deletions builder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Hass.io wheels builder for Home Assistant."""
1 change: 1 addition & 0 deletions builder/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Hass.io Builder main application."""
7 changes: 7 additions & 0 deletions builder/pip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Pip build commands."""
import subprocess
from pathlib import Path


def build_wheels(requirements: Path, index: str, output: Path) -> bool:
"""Build wheels from a requirements file into output."""
51 changes: 51 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[MASTER]
reports=no

# Reasons disabled:
# locally-disabled - it spams too much
# duplicate-code - unavoidable
# cyclic-import - doesn't test if both import on load
# abstract-class-little-used - prevents from setting right foundation
# abstract-class-not-used - is flaky, should not show up but does
# unused-argument - generic callbacks and setup methods create a lot of warnings
# global-statement - used for the on-demand requirement installation
# redefined-variable-type - this is Python, we're duck typing!
# too-many-* - are not enforced for the sake of readability
# too-few-* - same as too-many-*
# abstract-method - with intro of async there are always methods missing

disable=
abstract-class-little-used,
abstract-class-not-used,
abstract-method,
cyclic-import,
duplicate-code,
global-statement,
locally-disabled,
not-context-manager,
redefined-variable-type,
too-few-public-methods,
too-many-arguments,
too-many-branches,
too-many-instance-attributes,
too-many-lines,
too-many-locals,
too-many-public-methods,
too-many-return-statements,
too-many-statements,
unused-argument,
line-too-long,
bad-continuation,
too-few-public-methods,
no-self-use,
not-async-context-manager,
too-many-locals,
too-many-branches,
no-else-return

[EXCEPTIONS]
overgeneral-exceptions=Exception


[TYPECHECK]
ignored-modules = distutils
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
click==7.0
requests==2.21.0
2 changes: 2 additions & 0 deletions requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flake8==3.7.7
pylint==2.3.1
17 changes: 17 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[isort]
multi_line_output = 3
include_trailing_comma=True
force_grid_wrap=0
line_length=88
indent = " "
not_skip = __init__.py
force_sort_within_sections = true
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
forced_separate = tests
combine_as_imports = true
use_parentheses = true

[flake8]
max-line-length = 88
ignore = E501, W503
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from setuptools import setup

VERSION=0.1

setup(
name='builder',
version=VERSION,
license='Apache License 2.0',
author='The Home Assistant Authors',
author_email='[email protected]',
url='https://home-assistant.io/',
description="Hass.io wheels builder form Home Assistant.",
long_description="",
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Topic :: Home Automation'
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering :: Atmospheric Science',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3.7',
],
keywords=['docker', 'home-assistant', 'hass.io'],
zip_safe=False,
platforms='any',
packages=['builder'],
include_package_data=True)
19 changes: 19 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tox]
envlist = lint, tests

[testenv]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements_tests.txt

[testenv:lint]
basepython = python3
ignore_errors = True
commands =
flake8 hassio
pylint --rcfile pylintrc hassio

[testenv:tests]
basepython = python3
commands =
pytest --duration=10 tests

0 comments on commit 59545b6

Please sign in to comment.