Skip to content

Commit

Permalink
Changes to run CI tests with pylint 2.x and removed Trusty CI tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored and Onager committed Jan 21, 2019
1 parent 9e15943 commit 0f0547a
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 56 deletions.
28 changes: 15 additions & 13 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pylint 1.7.x - 1.9.x configuration file
# Pylint 2.1.x - 2.2.x configuration file
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.
Expand Down Expand Up @@ -56,23 +56,23 @@ confidence=
# --disable=W"
#
disable=
duplicate-code,
parameter-unpacking,
raw-checker-failed,
assignment-from-none,
bad-inline-option,
locally-disabled,
locally-enabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
no-absolute-import,
missing-param-doc,
metaclass-assignment,
duplicate-code,
eq-without-hash,
file-ignored,
fixme,
locally-disabled,
locally-enabled,
logging-format-interpolation,
metaclass-assignment,
missing-param-doc,
no-absolute-import,
no-self-use,
parameter-unpacking,
raw-checker-failed,
suppressed-message,
too-few-public-methods,
too-many-ancestors,
too-many-boolean-expressions,
Expand All @@ -84,7 +84,9 @@ disable=
too-many-public-methods,
too-many-return-statements,
too-many-statements,
unsubscriptable-object
unsubscriptable-object,
useless-object-inheritance,
useless-suppression

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
23 changes: 3 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ matrix:
include:
- env: TARGET="pylint"
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 2.7
python: 3.5
virtualenv:
system_site_packages: true
- env: TARGET="linux-python27"
Expand Down Expand Up @@ -76,24 +76,6 @@ matrix:
os: osx
osx_image: xcode9.2
language: generic
- env: TARGET="trusty-python27"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: true
- env: TARGET="trusty-python34"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 3.4
virtualenv:
system_site_packages: true
- env: TARGET="jenkins"
os: linux
dist: trusty
Expand All @@ -105,4 +87,5 @@ install:
script:
- ./config/travis/run_with_timeout.sh 30 ./config/travis/runtests.sh
after_success:
- if ! test -f /usr/bin/coverage; then sudo ln -s /usr/bin/python-coverage /usr/bin/coverage; fi
- if test ${TARGET} = "linux-python27"; then curl -o codecov.sh -s https://codecov.io/bash && /bin/bash ./codecov.sh; fi
2 changes: 2 additions & 0 deletions config/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ then
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
sudo add-apt-repository ppa:gift/pylint2 -y;
else
sudo add-apt-repository ppa:gift/pylint3 -y;
fi
fi

Expand Down
79 changes: 56 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ def _make_spec_file(self):
spec_file = bdist_rpm._make_spec_file(self)

if sys.version_info[0] < 3:
python_package = 'python'
python_package = 'python2'
else:
python_package = 'python3'

description = []
requires = ''
summary = ''
in_description = False

Expand All @@ -98,35 +99,60 @@ def _make_spec_file(self):
summary = line

elif line.startswith('BuildRequires: '):
line = 'BuildRequires: {0:s}-setuptools'.format(python_package)
line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format(
python_package)

elif line.startswith('Requires: '):
requires = line[10:]
if python_package == 'python3':
line = line.replace('python', 'python3')
requires = requires.replace('python-', 'python3-')
requires = requires.replace('python2-', 'python3-')

elif line.startswith('%description'):
in_description = True

elif line.startswith('python setup.py build'):
if python_package == 'python3':
line = '%py3_build'
else:
line = '%py2_build'

elif line.startswith('python setup.py install'):
if python_package == 'python3':
line = '%py3_install'
else:
line = '%py2_install'

elif line.startswith('%files'):
# Cannot use %{_libdir} here since it can expand to "lib64".
lines = [
'%files -n {0:s}-%{{name}}'.format(python_package),
'%defattr(644,root,root,755)',
'%doc ACKNOWLEDGEMENTS AUTHORS LICENSE README',
'%{_prefix}/lib/python*/site-packages/dfvfs/*.py',
'%{_prefix}/lib/python*/site-packages/dfvfs/*/*.py',
'%{_prefix}/lib/python*/site-packages/dfvfs/*/*.yaml',
'%{_prefix}/lib/python*/site-packages/dfvfs*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{_prefix}/lib/python*/site-packages/dfvfs/*.pyc',
'%exclude %{_prefix}/lib/python*/site-packages/dfvfs/*.pyo',
('%exclude %{_prefix}/lib/python*/site-packages/dfvfs/'
'__pycache__/*'),
'%exclude %{_prefix}/lib/python*/site-packages/dfvfs/*/*.pyc',
'%exclude %{_prefix}/lib/python*/site-packages/dfvfs/*/*.pyo',
('%exclude %{_prefix}/lib/python*/site-packages/dfvfs/*/'
'__pycache__/*')]
'%license LICENSE',
'%doc ACKNOWLEDGEMENTS AUTHORS README']

if python_package == 'python3':
lines.extend([
'%{python3_sitelib}/dfvfs/*.py',
'%{python3_sitelib}/dfvfs/*/*.py',
'%{python3_sitelib}/dfvfs/*/*.yaml',
'%{python3_sitelib}/dfvfs*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{python3_sitelib}/dfvfs/__pycache__/*',
'%exclude %{python3_sitelib}/dfvfs/*/__pycache__/*'])

else:
lines.extend([
'%{python2_sitelib}/dfvfs/*.py',
'%{python2_sitelib}/dfvfs/*/*.py',
'%{python2_sitelib}/dfvfs/*/*.yaml',
'%{python2_sitelib}/dfvfs*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{python2_sitelib}/dfvfs/*.pyc',
'%exclude %{python2_sitelib}/dfvfs/*.pyo',
'%exclude %{python2_sitelib}/dfvfs/*/*.pyc',
'%exclude %{python2_sitelib}/dfvfs/*/*.pyo'])

python_spec_file.extend(lines)
break
Expand All @@ -136,10 +162,17 @@ def _make_spec_file(self):

python_spec_file.append(
'%package -n {0:s}-%{{name}}'.format(python_package))
python_spec_file.append('{0:s}'.format(summary))
python_spec_file.append('')
python_spec_file.append(
'%description -n {0:s}-%{{name}}'.format(python_package))
if python_package == 'python2':
python_spec_file.extend([
'Obsoletes: python-dfvfs < %{version}',
'Provides: python-dfvfs = %{version}'])

python_spec_file.extend([
'Requires: {0:s}'.format(requires),
'{0:s}'.format(summary),
'',
'%description -n {0:s}-%{{name}}'.format(python_package)])

python_spec_file.extend(description)

elif in_description:
Expand Down

0 comments on commit 0f0547a

Please sign in to comment.