forked from openscanhub/openscanhub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
76 lines (66 loc) · 2.09 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
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright contributors to the OpenScanHub project.
import os
from glob import glob
from pathlib import Path
from setuptools import PEP420PackageFinder, setup
from scripts.include import (get_git_date_and_time, get_git_version,
git_check_tag_for_HEAD)
find_namespace_packages = PEP420PackageFinder.find
THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__))
package_version = [0, 9, 3]
data_files = {
"/etc/osh": [
"osh/client/client.conf",
"osh/worker/worker.conf",
],
"/usr/lib/systemd/system": [
"osh/hub/osh-stats.service",
"osh/hub/osh-stats.timer",
"osh/worker/osh-worker.service",
],
"/usr/share/bash-completion/completions": [
"osh/client/completion/osh-cli.bash",
],
"/usr/bin": [
"osh/client/osh-cli",
],
"/usr/sbin": [
"osh/hub/scripts/osh-stats",
"osh/worker/osh-worker",
],
}
package_data = {
"osh": [
"hub/osh-hub.wsgi",
"hub/scripts/checker_groups.txt",
]
}
hub_path = Path("osh/hub")
for folder in (
"templates",
"media",
"scan/fixtures",
"errata/fixtures",
):
for path in glob(str(hub_path / folder / "**"), recursive=True):
path = Path(path)
if path.is_file():
package_data["osh"].append(str(path.relative_to("osh")))
if os.path.isdir(".git"):
if not git_check_tag_for_HEAD(THIS_FILE_PATH):
package_version.append("git")
git_version = get_git_version(THIS_FILE_PATH)
git_date, git_time = get_git_date_and_time(THIS_FILE_PATH)
package_version += [git_date, git_time, git_version]
setup(
name="osh",
version=".".join(map(str, package_version)),
url="https://gitlab.cee.redhat.com/covscan/covscan",
author="Red Hat, Inc.",
author_email="[email protected]",
description="OpenScanHub is a service for static and dynamic analysis.",
packages=find_namespace_packages(exclude=["kobo*"]),
package_data=package_data,
data_files=data_files.items(),
)