Updated Makefile and setup to include the man file as part of the install.

This commit is contained in:
Elf M. Sternberg 2016-09-30 11:49:21 -07:00
parent 1db5feac16
commit 08537128bb
4 changed files with 62 additions and 3 deletions

View File

@ -12,6 +12,7 @@ export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@echo "all - local build including docs"
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@ -21,10 +22,14 @@ help:
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "docsbrowse - generate Sphinx HTML documentation and start browser"
@echo "release - package and upload a release"
@echo "dist - package"
@echo "install - install the package to the active Python's site-packages"
all: docs
python setup.py build
clean: clean-build clean-pyc clean-test
clean-build:
@ -67,6 +72,9 @@ docs:
sphinx-apidoc -o docs/ git_lint
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(MAKE) -C docs man
docbrowse: docs
$(BROWSER) docs/_build/html/index.html
servedocs: docs
@ -82,4 +90,4 @@ dist: clean
ls -l dist
install: clean
python setup.py install
python setup.py install --prefix=/usr/local

View File

@ -14,7 +14,7 @@
Scan the workspace [default]
**-s, --staging**
Scan the staging area (useful for pre-commit).
**-c** <path>, --config**=<path> Path to config file
**-c <path>, --config**=<path> Path to config file
**-d, --dryrun**
Report what git-lint would do, but don't actually do anything.
**-q, --quiet**

View File

@ -12,6 +12,30 @@ git_lint.git_lint module
:undoc-members:
:show-inheritance:
git_lint.option_handler module
------------------------------
.. automodule:: git_lint.option_handler
:members:
:undoc-members:
:show-inheritance:
git_lint.options module
-----------------------
.. automodule:: git_lint.options
:members:
:undoc-members:
:show-inheritance:
git_lint.reporters module
-------------------------
.. automodule:: git_lint.reporters
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------

View File

@ -1,6 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import argparse
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):
return [(os.path.join(_resolve_prefix(prefix, 'man'), 'man/man1'), ['docs/_build/man/git-lint.1'])]
parser = argparse.ArgumentParser()
parser.add_argument('--prefix', default='',
help='prefix to install data files')
opts, _ = parser.parse_known_args(sys.argv)
prefix = opts.prefix or '/usr'
try:
from setuptools import setup
@ -22,6 +46,8 @@ test_requirements = [
# TODO: put package test requirements here
]
print get_data_files(prefix)
setup(
name='git_linter',
version='0.0.4',
@ -36,6 +62,7 @@ setup(
package_dir={'git_lint':
'git_lint'},
include_package_data=True,
data_files = get_data_files(prefix),
install_requires=requirements,
license="MIT",
zip_safe=False,