Fixed paths to prefix and man page.
This commit is contained in:
parent
dd4aeb1cad
commit
aa4b5aa978
|
@ -9,3 +9,4 @@ recursive-exclude * __pycache__
|
||||||
recursive-exclude * *.py[co]
|
recursive-exclude * *.py[co]
|
||||||
|
|
||||||
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
|
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
|
||||||
|
include docs/_build/man/git-lint.1
|
||||||
|
|
18
setup.py
18
setup.py
|
@ -5,27 +5,15 @@ import argparse
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
def _resolve_prefix(prefix, type):
|
|
||||||
osx_system_prefix = r'^/System/Library/Frameworks/Python.framework/Versions'
|
|
||||||
matches = {'man': [(r'^/usr$', '/usr/share'),
|
|
||||||
(r'^/usr/local$', '/usr/local/share'),
|
|
||||||
(osx_system_prefix, '/usr/share')]}
|
|
||||||
|
|
||||||
match = [i[1] for i in matches.get(type, []) if re.match(i[0], prefix)]
|
|
||||||
if not len(match):
|
|
||||||
raise ValueError("not supported type: {}".format(type))
|
|
||||||
return match.pop()
|
|
||||||
|
|
||||||
|
|
||||||
def get_data_files(prefix):
|
def get_data_files(prefix):
|
||||||
return [(os.path.join(_resolve_prefix(prefix, 'man'), 'man/man1'), ['docs/_build/man/git-lint.1'])]
|
return [(os.path.join(prefix, 'share/man/man1'), ['docs/_build/man/git-lint.1'])]
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--prefix', default='',
|
parser.add_argument('--prefix', default='',
|
||||||
help='prefix to install data files')
|
help='prefix to install data files')
|
||||||
opts, _ = parser.parse_known_args(sys.argv)
|
opts, _ = parser.parse_known_args(sys.argv)
|
||||||
prefix = opts.prefix or '/usr'
|
prefix = opts.prefix or sys.prefix or '/usr'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
@ -47,8 +35,6 @@ test_requirements = [
|
||||||
# TODO: put package test requirements here
|
# TODO: put package test requirements here
|
||||||
]
|
]
|
||||||
|
|
||||||
print get_data_files(prefix)
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='git_linter',
|
name='git_linter',
|
||||||
version='0.0.4',
|
version='0.0.4',
|
||||||
|
|
Loading…
Reference in New Issue