Move constants to setup.py (#10312)
* Remove unused import * Move setup relevant consts to 'setup.py' * remove blank line * Set source
This commit is contained in:
parent
a43f99a71c
commit
81324806d5
6 changed files with 59 additions and 57 deletions
|
@ -19,15 +19,13 @@
|
||||||
#
|
#
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from os.path import relpath
|
|
||||||
import inspect
|
import inspect
|
||||||
from homeassistant.const import (__version__, __short_version__, PROJECT_NAME,
|
|
||||||
PROJECT_LONG_DESCRIPTION,
|
|
||||||
PROJECT_COPYRIGHT, PROJECT_AUTHOR,
|
|
||||||
PROJECT_GITHUB_USERNAME,
|
|
||||||
PROJECT_GITHUB_REPOSITORY,
|
|
||||||
GITHUB_PATH, GITHUB_URL)
|
|
||||||
|
|
||||||
|
from homeassistant.const import __version__, __short_version__
|
||||||
|
from setup import (
|
||||||
|
PROJECT_NAME, PROJECT_LONG_DESCRIPTION, PROJECT_COPYRIGHT, PROJECT_AUTHOR,
|
||||||
|
PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY, GITHUB_PATH,
|
||||||
|
GITHUB_URL)
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath('_ext'))
|
sys.path.insert(0, os.path.abspath('_ext'))
|
||||||
sys.path.insert(0, os.path.abspath('../homeassistant'))
|
sys.path.insert(0, os.path.abspath('../homeassistant'))
|
||||||
|
@ -87,9 +85,7 @@ edit_on_github_src_path = 'docs/source/'
|
||||||
|
|
||||||
|
|
||||||
def linkcode_resolve(domain, info):
|
def linkcode_resolve(domain, info):
|
||||||
"""
|
"""Determine the URL corresponding to Python object."""
|
||||||
Determine the URL corresponding to Python object
|
|
||||||
"""
|
|
||||||
if domain != 'py':
|
if domain != 'py':
|
||||||
return None
|
return None
|
||||||
modname = info['module']
|
modname = info['module']
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import PROJECT_NAME, HTTP_BAD_REQUEST
|
from homeassistant.const import HTTP_BAD_REQUEST
|
||||||
from homeassistant.helpers import intent, template
|
from homeassistant.helpers import intent, template
|
||||||
from homeassistant.components.http import HomeAssistantView
|
from homeassistant.components.http import HomeAssistantView
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ DOMAIN = 'dialogflow'
|
||||||
|
|
||||||
INTENTS_API_ENDPOINT = '/api/dialogflow'
|
INTENTS_API_ENDPOINT = '/api/dialogflow'
|
||||||
|
|
||||||
|
SOURCE = "Home Assistant Dialogflow"
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: {}
|
DOMAIN: {}
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
@ -128,5 +130,5 @@ class DialogflowResponse(object):
|
||||||
return {
|
return {
|
||||||
'speech': self.speech,
|
'speech': self.speech,
|
||||||
'displayText': self.speech,
|
'displayText': self.speech,
|
||||||
'source': PROJECT_NAME,
|
'source': SOURCE,
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,16 @@ import voluptuous as vol
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DOMAIN, CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME, HTTP_HEADER_AUTH,
|
CONF_DOMAIN, CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME, HTTP_HEADER_AUTH,
|
||||||
HTTP_HEADER_USER_AGENT, PROJECT_EMAIL)
|
HTTP_HEADER_USER_AGENT)
|
||||||
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE
|
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DOMAIN = 'no_ip'
|
DOMAIN = 'no_ip'
|
||||||
|
|
||||||
|
# We should set a dedicated address for the user agent.
|
||||||
|
EMAIL = 'hello@home-assistant.io'
|
||||||
|
|
||||||
INTERVAL = timedelta(minutes=5)
|
INTERVAL = timedelta(minutes=5)
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 10
|
DEFAULT_TIMEOUT = 10
|
||||||
|
@ -38,7 +41,7 @@ NO_IP_ERRORS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
UPDATE_URL = 'https://dynupdate.noip.com/nic/update'
|
UPDATE_URL = 'https://dynupdate.noip.com/nic/update'
|
||||||
USER_AGENT = "{} {}".format(SERVER_SOFTWARE, PROJECT_EMAIL)
|
USER_AGENT = "{} {}".format(SERVER_SOFTWARE, EMAIL)
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: vol.Schema({
|
DOMAIN: vol.Schema({
|
||||||
|
|
|
@ -9,37 +9,7 @@ REQUIRED_PYTHON_VER = (3, 4, 2)
|
||||||
REQUIRED_PYTHON_VER_WIN = (3, 5, 2)
|
REQUIRED_PYTHON_VER_WIN = (3, 5, 2)
|
||||||
CONSTRAINT_FILE = 'package_constraints.txt'
|
CONSTRAINT_FILE = 'package_constraints.txt'
|
||||||
|
|
||||||
PROJECT_NAME = 'Home Assistant'
|
# Format for platforms
|
||||||
PROJECT_PACKAGE_NAME = 'homeassistant'
|
|
||||||
PROJECT_LICENSE = 'Apache License 2.0'
|
|
||||||
PROJECT_AUTHOR = 'The Home Assistant Authors'
|
|
||||||
PROJECT_COPYRIGHT = ' 2013, {}'.format(PROJECT_AUTHOR)
|
|
||||||
PROJECT_URL = 'https://home-assistant.io/'
|
|
||||||
PROJECT_EMAIL = 'hello@home-assistant.io'
|
|
||||||
PROJECT_DESCRIPTION = ('Open-source home automation platform '
|
|
||||||
'running on Python 3.')
|
|
||||||
PROJECT_LONG_DESCRIPTION = ('Home Assistant is an open-source '
|
|
||||||
'home automation platform running on Python 3. '
|
|
||||||
'Track and control all devices at home and '
|
|
||||||
'automate control. '
|
|
||||||
'Installation in less than a minute.')
|
|
||||||
PROJECT_CLASSIFIERS = [
|
|
||||||
'Intended Audience :: End Users/Desktop',
|
|
||||||
'Intended Audience :: Developers',
|
|
||||||
'License :: OSI Approved :: Apache Software License',
|
|
||||||
'Operating System :: OS Independent',
|
|
||||||
'Programming Language :: Python :: 3.4',
|
|
||||||
'Topic :: Home Automation'
|
|
||||||
]
|
|
||||||
|
|
||||||
PROJECT_GITHUB_USERNAME = 'home-assistant'
|
|
||||||
PROJECT_GITHUB_REPOSITORY = 'home-assistant'
|
|
||||||
|
|
||||||
PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME)
|
|
||||||
GITHUB_PATH = '{}/{}'.format(PROJECT_GITHUB_USERNAME,
|
|
||||||
PROJECT_GITHUB_REPOSITORY)
|
|
||||||
GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH)
|
|
||||||
|
|
||||||
PLATFORM_FORMAT = '{}.{}'
|
PLATFORM_FORMAT = '{}.{}'
|
||||||
|
|
||||||
# Can be used to specify a catch all when registering state or event listeners.
|
# Can be used to specify a catch all when registering state or event listeners.
|
||||||
|
@ -48,8 +18,7 @@ MATCH_ALL = '*'
|
||||||
# If no name is specified
|
# If no name is specified
|
||||||
DEVICE_DEFAULT_NAME = 'Unnamed Device'
|
DEVICE_DEFAULT_NAME = 'Unnamed Device'
|
||||||
|
|
||||||
WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
|
# Sun events
|
||||||
|
|
||||||
SUN_EVENT_SUNSET = 'sunset'
|
SUN_EVENT_SUNSET = 'sunset'
|
||||||
SUN_EVENT_SUNRISE = 'sunrise'
|
SUN_EVENT_SUNRISE = 'sunrise'
|
||||||
|
|
||||||
|
@ -463,3 +432,5 @@ VOLUME = 'volume' # type: str
|
||||||
TEMPERATURE = 'temperature' # type: str
|
TEMPERATURE = 'temperature' # type: str
|
||||||
SPEED_MS = 'speed_ms' # type: str
|
SPEED_MS = 'speed_ms' # type: str
|
||||||
ILLUMINANCE = 'illuminance' # type: str
|
ILLUMINANCE = 'illuminance' # type: str
|
||||||
|
|
||||||
|
WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""All methods needed to bootstrap a Home Assistant instance."""
|
"""All methods needed to bootstrap a Home Assistant instance."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
import os
|
||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
|
@ -9,13 +8,13 @@ from types import ModuleType
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict
|
||||||
|
|
||||||
import homeassistant.config as conf_util
|
import homeassistant.config as conf_util
|
||||||
from homeassistant.config import async_notify_setup_error
|
|
||||||
import homeassistant.core as core
|
import homeassistant.core as core
|
||||||
import homeassistant.loader as loader
|
import homeassistant.loader as loader
|
||||||
import homeassistant.util.package as pkg_util
|
import homeassistant.util.package as pkg_util
|
||||||
from homeassistant.util.async import run_coroutine_threadsafe
|
from homeassistant.config import async_notify_setup_error
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
EVENT_COMPONENT_LOADED, PLATFORM_FORMAT, CONSTRAINT_FILE)
|
EVENT_COMPONENT_LOADED, PLATFORM_FORMAT, CONSTRAINT_FILE)
|
||||||
|
from homeassistant.util.async import run_coroutine_threadsafe
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
45
setup.py
45
setup.py
|
@ -2,15 +2,46 @@
|
||||||
"""Home Assistant setup script."""
|
"""Home Assistant setup script."""
|
||||||
import os
|
import os
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from homeassistant.const import (__version__, PROJECT_PACKAGE_NAME,
|
|
||||||
PROJECT_LICENSE, PROJECT_URL,
|
from homeassistant.const import __version__
|
||||||
PROJECT_EMAIL, PROJECT_DESCRIPTION,
|
|
||||||
PROJECT_CLASSIFIERS, GITHUB_URL,
|
PROJECT_NAME = 'Home Assistant'
|
||||||
PROJECT_AUTHOR)
|
PROJECT_PACKAGE_NAME = 'homeassistant'
|
||||||
|
PROJECT_LICENSE = 'Apache License 2.0'
|
||||||
|
PROJECT_AUTHOR = 'The Home Assistant Authors'
|
||||||
|
PROJECT_COPYRIGHT = ' 2013-2017, {}'.format(PROJECT_AUTHOR)
|
||||||
|
PROJECT_URL = 'https://home-assistant.io/'
|
||||||
|
PROJECT_EMAIL = 'hello@home-assistant.io'
|
||||||
|
PROJECT_DESCRIPTION = ('Open-source home automation platform '
|
||||||
|
'running on Python 3.')
|
||||||
|
PROJECT_LONG_DESCRIPTION = ('Home Assistant is an open-source '
|
||||||
|
'home automation platform running on Python 3. '
|
||||||
|
'Track and control all devices at home and '
|
||||||
|
'automate control. '
|
||||||
|
'Installation in less than a minute.')
|
||||||
|
PROJECT_CLASSIFIERS = [
|
||||||
|
'Development Status :: 4 - Beta',
|
||||||
|
'Intended Audience :: End Users/Desktop',
|
||||||
|
'Intended Audience :: Developers',
|
||||||
|
'License :: OSI Approved :: Apache Software License',
|
||||||
|
'Operating System :: OS Independent',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
|
'Programming Language :: Python :: 3.6',
|
||||||
|
'Topic :: Home Automation'
|
||||||
|
]
|
||||||
|
|
||||||
|
PROJECT_GITHUB_USERNAME = 'home-assistant'
|
||||||
|
PROJECT_GITHUB_REPOSITORY = 'home-assistant'
|
||||||
|
|
||||||
|
PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME)
|
||||||
|
GITHUB_PATH = '{}/{}'.format(
|
||||||
|
PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY)
|
||||||
|
GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH)
|
||||||
|
|
||||||
|
|
||||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||||
DOWNLOAD_URL = ('{}/archive/'
|
DOWNLOAD_URL = '{}/archive/{}.zip'.format(GITHUB_URL, __version__)
|
||||||
'{}.zip'.format(GITHUB_URL, __version__))
|
|
||||||
|
|
||||||
PACKAGES = find_packages(exclude=['tests', 'tests.*'])
|
PACKAGES = find_packages(exclude=['tests', 'tests.*'])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue