Permalink
Browse files

Changes to setup.py for bdist_rpm (#304)

  • Loading branch information...
joachimmetz committed Jan 13, 2019
1 parent af4c2e5 commit 8a9d8471af6f31fb8a604f6962b90d892153d5a8
Showing with 41 additions and 20 deletions.
  1. +1 −0 .travis.yml
  2. +1 −1 artifacts/__init__.py
  3. +2 −2 config/dpkg/changelog
  4. +1 −1 dependencies.ini
  5. +1 −1 setup.cfg
  6. +35 −15 setup.py
@@ -99,4 +99,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
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""ForensicArtifacts.com Artifact Repository."""

__version__ = '20190111'
__version__ = '20190113'
@@ -1,5 +1,5 @@
artifacts (20190111-1) unstable; urgency=low
artifacts (20190113-1) unstable; urgency=low

* Auto-generated

-- Forensic artifacts <forensicartifacts@googlegroups.com> Fri, 11 Jan 2019 09:42:31 +0100
-- Forensic artifacts <forensicartifacts@googlegroups.com> Sun, 13 Jan 2019 09:44:56 +0100
@@ -3,5 +3,5 @@ dpkg_name: python-yaml
l2tbinaries_name: PyYAML
minimum_version: 3.10
pypi_name: PyYAML
rpm_name: PyYAML
rpm_name: python2-pyyaml
version_property: __version__
@@ -9,7 +9,7 @@ doc_files = ACKNOWLEDGEMENTS
LICENSE
README
build_requires = python-setuptools
requires = PyYAML >= 3.10
requires = python2-pyyaml >= 3.10

[bdist_wheel]
universal = 1
@@ -86,6 +86,7 @@ def _make_spec_file(self):
python_package = 'python3'

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

@@ -99,9 +100,10 @@ def _make_spec_file(self):
python_package)

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

elif line.startswith('%description'):
in_description = True
@@ -120,17 +122,25 @@ def _make_spec_file(self):

elif line.startswith('%files'):
lines = [
'%files -n %{name}-data',
'%defattr(644,root,root,755)',
'%license LICENSE',
'%doc ACKNOWLEDGEMENTS AUTHORS README',
'%{_datadir}/%{name}/*',
'',
'%files -n {0:s}-%{{name}}'.format(python_package),
'%defattr(644,root,root,755)',
'%doc ACKNOWLEDGEMENTS AUTHORS LICENSE README']
'%license LICENSE',
'%doc ACKNOWLEDGEMENTS AUTHORS README']

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

else:
lines.extend([
@@ -139,26 +149,36 @@ def _make_spec_file(self):
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{python2_sitelib}/artifacts/*.pyc',
'%exclude %{python2_sitelib}/artifacts/*.pyo'])
'%exclude %{python2_sitelib}/artifacts/*.pyo',
'%exclude %{_bindir}/*.py'])

python_spec_file.extend(lines)
break

elif line.startswith('%prep'):
in_description = False

python_spec_file.extend([
'%package -n %{name}-data',
'Summary: Data files for {0:s}'.format(summary),
'',
'%description -n %{name}-data'])

python_spec_file.extend(description)

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

python_spec_file.extend([
'Requires: %{{name}}-data, {0:s}'.format(requires),
'{0:s}'.format(summary),
'',
'%description -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))
python_spec_file.extend(description)

elif in_description:
@@ -214,13 +234,13 @@ def _make_spec_file(self):
'Programming Language :: Python',
],
packages=find_packages('.', exclude=[
'tests', 'tests.*', 'tools', 'utils']),
'docs', 'tests', 'tests.*', 'tools', 'utils']),
package_dir={
'artifacts': 'artifacts'
},
scripts=glob.glob(os.path.join('tools', '[a-z]*.py')),
data_files=[
('share/artifacts/data', glob.glob(
('share/artifacts', glob.glob(
os.path.join('data', '*'))),
('share/doc/artifacts', [
'ACKNOWLEDGEMENTS', 'AUTHORS', 'LICENSE', 'README']),

0 comments on commit 8a9d847

Please sign in to comment.