aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--requirements.txt1
-rw-r--r--setup.py94
-rw-r--r--sos.spec7
4 files changed, 13 insertions, 90 deletions
diff --git a/.gitignore b/.gitignore
index 55a1d408..4c2138f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ venv
MANIFEST
build/
dist/
+*sos.egg*
docs/_build
# Pycharm
diff --git a/requirements.txt b/requirements.txt
index 39f42161..00c5982d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,3 +3,4 @@ coverage>=4.0.3
Sphinx>=1.3.5
pexpect>=4.0.0
pyyaml
+setuptools
diff --git a/setup.py b/setup.py
index f2f9ecbe..30856907 100644
--- a/setup.py
+++ b/setup.py
@@ -1,84 +1,16 @@
#!/usr/bin/env python
-from distutils.core import setup
-from distutils.command.build import build
-from distutils.command.install_data import install_data
-from distutils.dep_util import newer
-from distutils.log import error
-
-import glob
-import os
-import re
-import subprocess
-import sys
-
+from setuptools import setup, find_packages
from sos import __version__ as VERSION
-PO_DIR = 'po'
-MO_DIR = os.path.join('build', 'mo')
-
-class BuildData(build):
- def run(self):
- build.run(self)
- for po in glob.glob(os.path.join(PO_DIR, '*.po')):
- lang = os.path.basename(po[:-3])
- mo = os.path.join(MO_DIR, lang, 'sos.mo')
-
- directory = os.path.dirname(mo)
- if not os.path.exists(directory):
- os.makedirs(directory)
-
- if newer(po, mo):
- try:
- rc = subprocess.call(['msgfmt', '-o', mo, po])
- if rc != 0:
- raise Warning("msgfmt returned %d" % (rc,))
- except Exception as e:
- error("Failed gettext.")
- sys.exit(1)
-
-class InstallData(install_data):
- def run(self):
- self.data_files.extend(self._find_mo_files())
- install_data.run(self)
-
- def _find_mo_files(self):
- data_files = []
- for mo in glob.glob(os.path.join(MO_DIR, '*', 'sos.mo')):
- lang = os.path.basename(os.path.dirname(mo))
- dest = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
- data_files.append((dest, [mo]))
- return data_files
-
- # Workaround https://bugs.python.org/issue644744
- def copy_file (self, filename, dirname):
- (out, _) = install_data.copy_file(self, filename, dirname)
- # match for man pages
- if re.search(r'/man/man\d/.+\.\d$', out):
- return (out+".gz", _)
- return (out, _)
-
-cmdclass = {'build': BuildData, 'install_data': InstallData}
-command_options = {}
-try:
- from sphinx.setup_command import BuildDoc
- cmdclass['build_sphinx'] = BuildDoc
- command_options={
- 'build_sphinx': {
- 'project': ('setup.py', 'sos'),
- 'version': ('setup.py', VERSION),
- 'source_dir': ('setup.py', 'docs')
- }
- }
-except Exception:
- print("Unable to build sphinx docs - module not present. Install sphinx "
- "to enable documentation generation")
setup(
name='sos',
version=VERSION,
- description=("""A set of tools to gather troubleshooting"""
- """ information from a system."""),
+ install_requires=['pexpect', 'pyyaml'],
+ description=(
+ 'A set of tools to gather troubleshooting information from a system'
+ ),
author='Bryn M. Reeves',
author_email='bmr@redhat.com',
maintainer='Jake Hunsaker',
@@ -96,19 +28,7 @@ setup(
('share/doc/sos', ['AUTHORS', 'README.md']),
('config', ['sos.conf'])
],
- packages=[
- 'sos', 'sos.presets', 'sos.presets.redhat', 'sos.policies',
- 'sos.policies.distros', 'sos.policies.runtimes',
- 'sos.policies.package_managers', 'sos.policies.init_systems',
- 'sos.report', 'sos.report.plugins', 'sos.collector',
- 'sos.collector.clusters', 'sos.collector.transports', 'sos.cleaner',
- 'sos.cleaner.mappings', 'sos.cleaner.parsers', 'sos.cleaner.archives',
- 'sos.help'
- ],
- cmdclass=cmdclass,
- command_options=command_options,
- requires=['pexpect', 'pyyaml']
- )
-
+ packages=find_packages(include=['sos', 'sos.*'])
+)
# vim: set et ts=4 sw=4 :
diff --git a/sos.spec b/sos.spec
index 08499816..1241f321 100644
--- a/sos.spec
+++ b/sos.spec
@@ -1,5 +1,3 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 4.4
@@ -11,6 +9,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
Url: https://github.com/sosreport/sos/
BuildRequires: python3-devel
+BuildRequires: python3-setuptools
BuildRequires: gettext
Requires: python3-rpm
Requires: tar
@@ -46,7 +45,9 @@ rm -rf ${RPM_BUILD_ROOT}/usr/config/
%find_lang %{name} || echo 0
-%files -f %{name}.lang
+# internationalization is currently broken. Uncomment this line once fixed.
+# %%files -f %%{name}.lang
+%files
%{_sbindir}/sos
%{_sbindir}/sosreport
%{_sbindir}/sos-collector