diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 87b99837d..1ae009b03 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -41,7 +41,7 @@ jobs: LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }} - name: Build and release package run: | - python3 -m pip install twine + python3 -m pip install twine build export TWINE_USERNAME="__token__" export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}" diff --git a/MANIFEST.in b/MANIFEST.in index 703dc5da5..384d62c07 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,4 @@ include README.md -include LICENSE.md graft hass_frontend graft hass_frontend_es5 recursive-exclude * *.py[co] diff --git a/build-scripts/env.js b/build-scripts/env.js index bda99cf01..1320c137d 100644 --- a/build-scripts/env.js +++ b/build-scripts/env.js @@ -26,11 +26,11 @@ module.exports = { }, version() { const version = fs - .readFileSync(path.resolve(paths.polymer_dir, "setup.py"), "utf8") - .match(/\d{8}\.\d+/); + .readFileSync(path.resolve(paths.polymer_dir, "setup.cfg"), "utf8") + .match(/version\W+=\W(\d{8}\.\d)/); if (!version) { throw Error("Version not found"); } - return version[0]; + return version[1]; }, }; diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..cad8f17be --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools~=60.5", "wheel~=0.37.1"] +build-backend = "setuptools.build_meta" diff --git a/script/release b/script/release index f2d6e91a0..3b981bf50 100755 --- a/script/release +++ b/script/release @@ -11,6 +11,6 @@ yarn install script/build_frontend -rm -rf dist -python3 setup.py -q sdist +rm -rf dist home_assistant_frontend.egg-info +python3 -m build python3 -m twine upload dist/* --skip-existing diff --git a/script/version_bump.js b/script/version_bump.js index 35ad851f1..74fc3770e 100755 --- a/script/version_bump.js +++ b/script/version_bump.js @@ -50,14 +50,14 @@ async function main(args) { return; } - const setup = fs.readFileSync("setup.py", "utf8"); + const setup = fs.readFileSync("setup.cfg", "utf8"); const version = setup.match(/\d{8}\.\d+/)[0]; const newVersion = method(version); console.log("Current version:", version); console.log("New version:", newVersion); - fs.writeFileSync("setup.py", setup.replace(version, newVersion), "utf-8"); + fs.writeFileSync("setup.cfg", setup.replace(version, newVersion), "utf-8"); if (!commit) { return; diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..cfcc00c7e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,21 @@ +[metadata] +name = home-assistant-frontend +version = 20220127.0 +author = The Home Assistant Authors +author_email = hello@home-assistant.io +license = Apache-2.0 +platforms = any +description = The Home Assistant frontend +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/home-assistant/frontend + +[options] +packages = find: +zip_safe = False +include_package_data = True +python_requires = >= 3.4.0 + +[options.packages.find] +include = + hass_frontend* diff --git a/setup.py b/setup.py index 7417efc3b..69bf65dd8 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,7 @@ -from setuptools import setup, find_packages +""" +Entry point for setuptools. Required for editable installs. +TODO: Remove file after updating to pip 21.3 +""" +from setuptools import setup -setup( - name="home-assistant-frontend", - version="20220127.0", - description="The Home Assistant frontend", - url="https://github.com/home-assistant/frontend", - author="The Home Assistant Authors", - author_email="hello@home-assistant.io", - license="Apache-2.0", - packages=find_packages(include=["hass_frontend", "hass_frontend.*"]), - include_package_data=True, - zip_safe=False, -) +setup()