Skip to content

Commit

Permalink
Enable Travis-CI
Browse files Browse the repository at this point in the history
- use /usr/bin/env instead of hard-coded /usr/bin/python3
- move mypy checks into the `check` target
- disable coverage + multiprocessing - generates lots of JSON errors
- disable pylint import checks for setup.py because of
  pylint-dev/pylint#73 (comment)
  • Loading branch information
atodorov committed Jun 29, 2016
1 parent e7b4a92 commit 4125266
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 15 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- "3.5"

install:
- pip install --upgrade pip setuptools
- pip install coverage mypy-lang nose ordered-set polib pylint requests six
- pip install https://github.com/atodorov/pocketlint/zipball/fallback_to_pypi_pylint

script:
- make ci
16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ PYTHON?=python3

ifeq ($(PYTHON),python3)
COVERAGE=coverage3
# Coverage + multiprocessing does not work under python2. Oh well, just don't use multiprocessing there.
# We default to python3 now so everyone else can just deal with the slowness.
NOSEARGS+=--processes=-1 $(tests)
NOSEARGS+=$(tests)
else
COVERAGE?=coverage
NOSEARGS+=$(filter-out tests/attrs.py,$(tests))
Expand All @@ -46,9 +44,12 @@ docs:
check:
@echo "*** Running pylint to verify source ***"
PYTHONPATH=. tests/pylint/runpylint.py
@which mypy || (echo "*** Please install mypy (python3-mypy) ***"; exit 2)
@echo "*** Running type checks ***"
PYTHONPATH=. mypy pykickstart
@echo "*** Running tests on translatable strings ***"
$(MAKE) -C po $(PKGNAME).pot
PYTHONPATH=translation-canary python3 -m translation_canary.translatable po/$(PKGNAME).pot
PYTHONPATH=translation-canary $(PYTHON) -m translation_canary.translatable po/$(PKGNAME).pot
git checkout -- po/$(PKGNAME).pot || true

# Left here for backwards compability - in case anyone was running the test target. Now you always get coverage.
Expand All @@ -60,9 +61,6 @@ coverage:
PYTHONPATH=. $(PYTHON) -m nose --with-coverage --cover-erase --cover-branches --cover-package=pykickstart --cover-package=tools $(NOSEARGS)
$(COVERAGE) combine
$(COVERAGE) report -m | tee coverage-report.log
@which mypy || (echo "*** Please install mypy (python3-mypy) ***"; exit 2)
@echo "*** Running type checks ***"
PYTHONPATH=. mypy pykickstart

clean:
-rm *.tar.gz pykickstart/*.pyc pykickstart/*/*.pyc tests/*.pyc tests/*/*.pyc docs/programmers-guide *log .coverage
Expand All @@ -87,7 +85,7 @@ archive: check test tag docs
cp -r po/*.po $(PKGNAME)-$(VERSION)/po/
$(MAKE) -C $(PKGNAME)-$(VERSION)/po
cp docs/programmers-guide $(PKGNAME)-$(VERSION)/docs/
PYTHONPATH=translation-canary python3 -m translation_canary.translated --release $(PKGNAME)-$(VERSION)
PYTHONPATH=translation-canary $(PYTHON) -m translation_canary.translated --release $(PKGNAME)-$(VERSION)
( cd $(PKGNAME)-$(VERSION) && $(PYTHON) setup.py -q sdist --dist-dir .. )
rm -rf $(PKGNAME)-$(VERSION)
git checkout -- po/$(PKGNAME).pot
Expand Down Expand Up @@ -141,6 +139,6 @@ rc-release: scratch-bumpver scratch
mock -r $(MOCKCHROOT) --rebuild *src.rpm --resultdir $(shell pwd) || exit 1

ci:
$(MAKE) PYTHON=python3 check coverage
$(MAKE) PYTHON=$(PYTHON) check coverage

.PHONY: check clean install tag archive local docs release
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pylint: disable=import-error,no-name-in-module
# See https://github.com/PyCQA/pylint/issues/73#issuecomment-163171888
from distutils.core import setup
from distutils.command.install_scripts import install_scripts as _install_scripts
from distutils.file_util import move_file
Expand Down
2 changes: 1 addition & 1 deletion tests/pylint/runpylint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python

import sys

Expand Down
2 changes: 1 addition & 1 deletion tools/ksflatten.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python
#
# Simple script to take a kickstart config, read it in, parse any %includes,
# etc to write out a flattened config that is stand-alone
Expand Down
2 changes: 1 addition & 1 deletion tools/ksshell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python
#
# Chris Lumens <clumens@redhat.com>
#
Expand Down
2 changes: 1 addition & 1 deletion tools/ksvalidator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#
# Chris Lumens <clumens@redhat.com>
#
Expand Down
2 changes: 1 addition & 1 deletion tools/ksverdiff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python
#
# Chris Lumens <clumens@redhat.com>
#
Expand Down
2 changes: 1 addition & 1 deletion translation-canary/tests/pylint/runpylint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python

import sys
from pocketlint import PocketLintConfig, PocketLinter
Expand Down

0 comments on commit 4125266

Please sign in to comment.