forked from apple/apple-llvm-infrastructure-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·69 lines (53 loc) · 1.87 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
#!/usr/bin/env python3
import os
import sys
import pkgutil
from shutil import rmtree
from setuptools import find_packages, setup, Command
from setuptools.command.install import install
here = os.path.abspath(os.path.dirname(__file__))
# The source packages are now located in libexec apple-llvm.
packages = find_packages('git_apple_llvm', exclude=[
"tests", "*.tests", "*.tests.*", "tests.*"])
packages = [f'git_apple_llvm.{x}' for x in packages]
libexec_paths = []
for dirname, _, files in os.walk('libexec'):
libexec_paths += [(dirname, [os.path.join(dirname, f) for f in files])]
class CleanCommand(Command):
"""Custom clean command to tidy up the project root."""
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print('Removing build/ dist/ and egg-info/')
rmtree('build', ignore_errors=True)
rmtree('dist', ignore_errors=True)
rmtree('git_apple_llvm.egg-info', ignore_errors=True)
class InfoCommand(Command):
"""The command that prints out the resolved information, like packages."""
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print('Packages for git-apple-llvm:')
for package in packages:
print(' ', package)
# FIXME: mention license.
setup(
name='git-apple-llvm',
version='0.1.0',
description='Infrastructure-related tools for working with LLVM-derived projects',
author='Apple',
python_requires='>=3.7.0',
packages=packages,
data_files=[] if os.getenv('GIT_APPLE_LLVM_NO_BIN_LIBEXEC') else [('bin', ['bin/git-apple-llvm'])] + libexec_paths,
install_requires=['click', 'appdirs', 'github3.py', 'redis'],
cmdclass={
'info': InfoCommand,
'clean': CleanCommand,
}
)