Skip to content

Commit

Permalink
Updated Makefile and setup to include the man file as part of the ins…
Browse files Browse the repository at this point in the history
…tall.
  • Loading branch information
elfsternberg committed Sep 30, 2016
1 parent 1db5fea commit 0853712
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Makefile
Expand Up @@ -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"
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -82,4 +90,4 @@ dist: clean
ls -l dist

install: clean
python setup.py install
python setup.py install --prefix=/usr/local
2 changes: 1 addition & 1 deletion docs/arguments.rst
Expand Up @@ -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**
Expand Down
24 changes: 24 additions & 0 deletions docs/git_lint.rst
Expand Up @@ -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
---------------
Expand Down
29 changes: 28 additions & 1 deletion setup.py
@@ -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
Expand All @@ -22,6 +46,8 @@
# TODO: put package test requirements here
]

print get_data_files(prefix)

setup(
name='git_linter',
version='0.0.4',
Expand All @@ -36,6 +62,7 @@
package_dir={'git_lint':
'git_lint'},
include_package_data=True,
data_files = get_data_files(prefix),
install_requires=requirements,
license="MIT",
zip_safe=False,
Expand Down

0 comments on commit 0853712

Please sign in to comment.