forked from Nextdoor/git-change
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
89 lines (77 loc) · 2.67 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
82
83
84
85
86
87
88
89
# Copyright 2012 Nextdoor.com, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import shutil
import subprocess
from distutils.command.clean import clean
from distutils.command.sdist import sdist
from setuptools import setup
PACKAGE = 'git_change'
__version__ = None
execfile(os.path.join(PACKAGE, 'version.py')) # set __version__
class SourceDistHook(sdist):
def run(self):
with open('version.rst', 'w') as f:
f.write(':Version: %s\n' % __version__)
shutil.copy('README.rst', 'README')
subprocess.call(['rst2man', 'git-change.rst', 'git-change.1'])
sdist.run(self)
os.unlink('MANIFEST')
os.unlink('README')
os.unlink('git-change.1')
os.unlink('version.rst')
class CleanHook(clean):
def run(self):
clean.run(self)
def maybe_rm(path):
if os.path.exists(path):
shutil.rmtree(path)
if self.all:
maybe_rm('git_change.egg-info')
maybe_rm('dist')
setup(
name='git-change',
version=__version__,
description='Git command to create and manage Gerrit Code Review changes',
long_description=open('README.rst').read(),
author='Jacob Hesch',
author_email='[email protected]',
url='https://github.com/Nextdoor/git-change',
download_url='http://pypi.python.org/pypi/git-change#downloads',
license='Apache License, Version 2.0',
keywords='gerrit git code review',
packages=[PACKAGE],
entry_points={
'console_scripts': ['git-change = git_change.git_change:app'],
},
data_files=[
('man/man1', ['git-change.1']),
('etc/bash_completion.d', ['extras/bash_completion.d/git-change']),
],
install_requires=[
'python-gflags',
'setuptools',
'simplejson',
],
classifiers=[
'Development Status :: 4 - Beta',
'Topic :: Software Development',
'License :: OSI Approved :: Apache Software License',
'Intended Audience :: Developers',
'Programming Language :: Python :: 2',
'Operating System :: POSIX',
'Natural Language :: English',
],
cmdclass={'sdist': SourceDistHook, 'clean': CleanHook},
)