forked from PowerGridModel/power-grid-model-io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
34 lines (24 loc) · 761 Bytes
/
setup.py
File metadata and controls
34 lines (24 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0
from pathlib import Path
# noinspection PyPackageRequirements
from setuptools import setup
def set_version(pkg_dir: Path):
# if PYPI_VERSION does not exist, copy from VERSION
pypi_file = pkg_dir / "PYPI_VERSION"
if not pypi_file.exists():
with open(pkg_dir / "VERSION") as f:
version = f.read().strip().strip("\n")
with open(pypi_file, "w") as f:
f.write(version)
def prepare_pkg(setup_file: Path):
"""
Args:
setup_file:
Returns:
"""
pkg_dir = setup_file.parent
set_version(pkg_dir)
prepare_pkg(Path(__file__).resolve())
setup()