-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
72 lines (62 loc) · 2.35 KB
/
setup.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python3
#
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 tw=100 et ai si
#
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
# Author: Artem Bityutskiy <[email protected]>
"""The standard python packaging script."""
import re
import os
from pathlib import Path
from setuptools import setup, find_packages
def get_version(filename):
"""Fetch the project version number."""
with open(filename, "r", encoding="utf-8") as fobj:
for line in fobj:
matchobj = re.match(r'^_VERSION = "(\d+.\d+.\d+)"$', line)
if matchobj:
return matchobj.group(1)
return None
def get_data_files(installdir, subdir, exclude=None):
"""
When the task is to include all files in the 'subdir' directory to the package and install them
under the 'installdir' directory, this function can be used to generate the list of files
suitable for the 'data_files' setup parameter.
"""
files_dict = {}
for root, _, files in os.walk(subdir):
for fname in files:
fname = Path(f"{root}/{fname}")
if exclude and str(fname) in exclude:
continue
key = str(Path(installdir) / fname.relative_to(subdir).parent)
if key not in files_dict:
files_dict[key] = []
files_dict[key].append(str(fname))
return list(files_dict.items())
setup(
name="pepc",
description="""Power, Energy, and Performance configuration tool""",
author="Artem Bityutskiy",
author_email="[email protected]",
python_requires=">=3.9",
version=get_version("pepctool/_Pepc.py"),
scripts=["pepc"],
packages=find_packages(exclude=["test*"]),
data_files=get_data_files("share/man/man1", "docs/man1") + \
get_data_files("share/pepc/tpmi", "tpmi"),
long_description="""A tool configuring various power and performance aspects of a Linux
system.""",
install_requires=["paramiko", "pyyaml", "colorama", "argcomplete"],
classifiers=[
"Intended Audience :: Developers",
"Topic :: System :: Hardware",
"Topic :: System :: Operating System Kernels :: Linux",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3 :: Only",
"Development Status :: 4 - Beta",
],
)