Skip to content

Commit ce0ced0

Browse files
authored
Move to setup.cfg and config for build-system (home-assistant#11484)
1 parent 730e9b1 commit ce0ced0

File tree

8 files changed

+38
-22
lines changed

8 files changed

+38
-22
lines changed

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
4242
- name: Build and release package
4343
run: |
44-
python3 -m pip install twine
44+
python3 -m pip install twine build
4545
export TWINE_USERNAME="__token__"
4646
export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}"
4747

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include README.md
2-
include LICENSE.md
32
graft hass_frontend
43
graft hass_frontend_es5
54
recursive-exclude * *.py[co]

build-scripts/env.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ module.exports = {
2626
},
2727
version() {
2828
const version = fs
29-
.readFileSync(path.resolve(paths.polymer_dir, "setup.py"), "utf8")
30-
.match(/\d{8}\.\d+/);
29+
.readFileSync(path.resolve(paths.polymer_dir, "setup.cfg"), "utf8")
30+
.match(/version\W+=\W(\d{8}\.\d)/);
3131
if (!version) {
3232
throw Error("Version not found");
3333
}
34-
return version[0];
34+
return version[1];
3535
},
3636
};

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools~=60.5", "wheel~=0.37.1"]
3+
build-backend = "setuptools.build_meta"

script/release

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ yarn install
1111

1212
script/build_frontend
1313

14-
rm -rf dist
15-
python3 setup.py -q sdist
14+
rm -rf dist home_assistant_frontend.egg-info
15+
python3 -m build
1616
python3 -m twine upload dist/* --skip-existing

script/version_bump.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ async function main(args) {
5050
return;
5151
}
5252

53-
const setup = fs.readFileSync("setup.py", "utf8");
53+
const setup = fs.readFileSync("setup.cfg", "utf8");
5454
const version = setup.match(/\d{8}\.\d+/)[0];
5555
const newVersion = method(version);
5656

5757
console.log("Current version:", version);
5858
console.log("New version:", newVersion);
5959

60-
fs.writeFileSync("setup.py", setup.replace(version, newVersion), "utf-8");
60+
fs.writeFileSync("setup.cfg", setup.replace(version, newVersion), "utf-8");
6161

6262
if (!commit) {
6363
return;

setup.cfg

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[metadata]
2+
name = home-assistant-frontend
3+
version = 20220127.0
4+
author = The Home Assistant Authors
5+
author_email = [email protected]
6+
license = Apache-2.0
7+
platforms = any
8+
description = The Home Assistant frontend
9+
long_description = file: README.md
10+
long_description_content_type = text/markdown
11+
url = https://github.com/home-assistant/frontend
12+
13+
[options]
14+
packages = find:
15+
zip_safe = False
16+
include_package_data = True
17+
python_requires = >= 3.4.0
18+
19+
[options.packages.find]
20+
include =
21+
hass_frontend*

setup.py

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
from setuptools import setup, find_packages
1+
"""
2+
Entry point for setuptools. Required for editable installs.
3+
TODO: Remove file after updating to pip 21.3
4+
"""
5+
from setuptools import setup
26

3-
setup(
4-
name="home-assistant-frontend",
5-
version="20220127.0",
6-
description="The Home Assistant frontend",
7-
url="https://github.com/home-assistant/frontend",
8-
author="The Home Assistant Authors",
9-
author_email="[email protected]",
10-
license="Apache-2.0",
11-
packages=find_packages(include=["hass_frontend", "hass_frontend.*"]),
12-
include_package_data=True,
13-
zip_safe=False,
14-
)
7+
setup()

0 commit comments

Comments
 (0)