-
Notifications
You must be signed in to change notification settings - Fork 761
/
setup.py
81 lines (65 loc) · 2.43 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
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
"""Setup configuration for the grr-response-client-builder package."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import configparser
import os
import shutil
from setuptools import find_packages
from setuptools import setup
from setuptools.command.sdist import sdist
THIS_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
os.chdir(THIS_DIRECTORY)
def get_config():
"""Get INI parser with version.ini data."""
ini_path = os.path.join(THIS_DIRECTORY, "version.ini")
if not os.path.exists(ini_path):
ini_path = os.path.join(THIS_DIRECTORY, "../../version.ini")
if not os.path.exists(ini_path):
raise RuntimeError("Couldn't find version.ini")
config = configparser.ConfigParser()
config.read(ini_path)
return config
VERSION = get_config()
class Sdist(sdist):
"""Custom sdist class that bundles GRR's version.ini."""
def make_release_tree(self, base_dir, files):
sdist.make_release_tree(self, base_dir, files)
sdist_version_ini = os.path.join(base_dir, "version.ini")
if os.path.exists(sdist_version_ini):
os.unlink(sdist_version_ini)
shutil.copy(
os.path.join(THIS_DIRECTORY, "../../version.ini"), sdist_version_ini)
# TODO: Clean up str() call after Python 2 support is
# dropped ('data_files' elements have to be bytes in Python 2).
data_files = [str("version.ini")]
setup_args = dict(
name="grr-response-client-builder",
version=VERSION.get("Version", "packageversion"),
description="GRR Rapid Response",
license="Apache License, Version 2.0",
maintainer="GRR Development Team",
maintainer_email="grr-dev@googlegroups.com",
url="https://github.com/google/grr",
entry_points={
"console_scripts": [
"grr_client_build = %s" %
("grr_response_client_builder.distro_entry:ClientBuild"),
]
},
cmdclass={"sdist": Sdist},
packages=find_packages(),
include_package_data=True,
python_requires=">=3.6",
install_requires=[
"distro==1.5.0",
"grr-response-client==%s" % VERSION.get("Version", "packagedepends"),
"grr-response-core==%s" % VERSION.get("Version", "packagedepends"),
"PyInstaller==3.6",
"fleetspeak-client-bin==0.1.9",
"olefile==0.46",
],
# Data files used by GRR. Access these via the config_lib "resource" filter.
data_files=data_files)
setup(**setup_args)