Skip to content

Commit

Permalink
Move to setup.cfg and config for build-system (home-assistant#11484)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Jan 29, 2022
1 parent 730e9b1 commit ce0ced0
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include README.md
include LICENSE.md
graft hass_frontend
graft hass_frontend_es5
recursive-exclude * *.py[co]
6 changes: 3 additions & 3 deletions build-scripts/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
},
};
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools~=60.5", "wheel~=0.37.1"]
build-backend = "setuptools.build_meta"
4 changes: 2 additions & 2 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions script/version_bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[metadata]
name = home-assistant-frontend
version = 20220127.0
author = The Home Assistant Authors
author_email = [email protected]
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*
19 changes: 6 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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="[email protected]",
license="Apache-2.0",
packages=find_packages(include=["hass_frontend", "hass_frontend.*"]),
include_package_data=True,
zip_safe=False,
)
setup()

0 comments on commit ce0ced0

Please sign in to comment.