-
Notifications
You must be signed in to change notification settings - Fork 37
/
setup.py
executable file
·68 lines (55 loc) · 2.16 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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import distutils.command.sdist
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
# override default tarball format with bzip2
distutils.command.sdist.sdist.default_format = {"posix": "bztar"}
# force to install data files to site-packages
for scheme in INSTALL_SCHEMES.values():
scheme["data"] = scheme["purelib"]
# recursively scan for python modules to be included
package_root_dirs = ["kobo"]
packages = set()
package_data = {}
for package_root_dir in package_root_dirs:
for root, dirs, files in os.walk(package_root_dir):
# ignore PEP 3147 cache dirs and those whose names start with '.'
dirs[:] = [i for i in dirs if not i.startswith('.') and i != '__pycache__']
parts = root.split("/")
if "__init__.py" in files:
package = ".".join(parts)
packages.add(package)
relative_path = ""
elif files:
relative_path = []
while ".".join(parts) not in packages:
relative_path.append(parts.pop())
if not relative_path:
continue
relative_path.reverse()
relative_path = os.path.join(*relative_path)
package = ".".join(parts)
else:
# not a module, no files -> skip
continue
package_files = package_data.setdefault(package, [])
package_files.extend([os.path.join(relative_path, i) for i in files if not i.endswith(".py")])
packages = sorted(packages)
for package in package_data.keys():
package_data[package] = sorted(package_data[package])
setup(
name = "kobo",
version = "0.39.0",
description = "A pile of python modules used by Red Hat release engineering to build their tools",
url = "https://github.com/release-engineering/kobo/",
author = "Red Hat, Inc.",
author_email = "[email protected]",
license = "LGPLv2.1",
packages = packages,
package_data = package_data,
scripts = ["kobo/admin/kobo-admin"],
install_requires=["six"],
python_requires ='>=3.6',
)