Skip to content

Commit

Permalink
Cleanup packaging.
Browse files Browse the repository at this point in the history
- Single requirements file
- Requirements in setup.py
- Improved Makefile
  • Loading branch information
rbarrois committed Jan 2, 2019
1 parent e0b2306 commit 5bd8244
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 55 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
ignore =
# Ignore "and" at start of line.
W503
# Ignore "do not assign a lambda expression, use a def".
E731
max-line-length = 120
26 changes: 19 additions & 7 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
include LICENSE
include README.rst
include ChangeLog
include initd/*
# Doc
include ChangeLog LICENSE README.rst
include man/*
include mpdlcd.conf
include requirements.txt
recursive-include tests *.py

# Packaging
include initd/* mpdlcd.conf

# Build/test
include Makefile .flake8
include requirements_dev.txt

# Package
graft mpdlcd
graft tests

# Remove temporary files
global-exclude *.py[cod] __pycache__ *.so .*.sw[op]

# Remove files useless in a sdist
exclude .travis.yml
38 changes: 30 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
all: default
PACKAGE = mpdlcd
TESTS_DIR = tests

FLAKE8 = flake8

PACKAGE=mpdlcd

# Default targets
# ===============

all: default
default:

.PHONY: all default


# Packaging
# =========

clean:
find . -type f -name '*.pyc' -delete
find . -type f -path '*/__pycache__/*' -delete
find . -type d -empty -delete

update:
pip install --upgrade pip setuptools
pip install --upgrade -r requirements_dev.txt
pip freeze

release:
fullrelease

.PHONY: clean update release


# Tests and quality
# =================

test:
python -W default setup.py test

coverage:
coverage erase
coverage run "--include=$(PACKAGE)/*.py,tests/*.py" --branch setup.py test
coverage report "--include=$(PACKAGE)/*.py,tests/*.py"
coverage html "--include=$(PACKAGE)/*.py,tests/*.py"
lint:
$(FLAKE8) --config .flake8 $(PACKAGE)
check-manifest


.PHONY: all default clean coverage doc test
.PHONY: test lint
2 changes: 0 additions & 2 deletions dev_requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions dev_requirements_py26.txt

This file was deleted.

2 changes: 0 additions & 2 deletions dev_requirements_py27.txt

This file was deleted.

13 changes: 0 additions & 13 deletions mpdlcd/compat.py

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-e .

check-manifest
coverage
flake8
zest.releaser[recommended]
24 changes: 6 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2015 Raphaël Barrois

import codecs
Expand All @@ -24,21 +23,7 @@ def get_version(package_name):
return '0.1.0'


def parse_requirements(requirements_file):
with codecs.open(requirements_file, 'r', 'utf-8') as f:
return [line for line in f if line.strip() and not line.startswith('#')]


if sys.version_info[0:2] < (2, 7):
extra_tests_require = ['unittest2', 'mock']
elif sys.version_info[0] < 3:
extra_tests_require = ['mock']
else:
extra_tests_require = []


PACKAGE = 'mpdlcd'
REQUIREMENTS_PATH = 'requirements.txt'


setup(
Expand All @@ -56,14 +41,17 @@ def parse_requirements(requirements_file):
setup_requires=[
'setuptools>=0.8',
],
install_requires=parse_requirements(REQUIREMENTS_PATH),
tests_require=[] + extra_tests_require,
install_requires=[
'lcdproc',
'python_mpd2',
],
tests_require=[],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: No Input/Output (Daemon)',
'Intended Audience :: End Users/Desktop',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Multimedia :: Sound/Audio',
],
test_suite='tests',
Expand Down

0 comments on commit 5bd8244

Please sign in to comment.