Skip to content

Commit

Permalink
RIP manpage build
Browse files Browse the repository at this point in the history
Since we no longer install manpages, there's no need to build then
during installation.  This sort of work should be moved to the
distribution scripts, since it's touching system man pages.

(Though apparently setuptools has no problem dumping things into
/usr/lib but hey who am I to complain?)
  • Loading branch information
marshallward committed Jan 30, 2018
1 parent 3f1530d commit 22b0153
Showing 1 changed file with 1 addition and 65 deletions.
66 changes: 1 addition & 65 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@
from distutils.core import setup
from distutils.core import Command

try:
from sphinx.setup_command import BuildDoc
has_sphinx = True

from distutils.command.build import build
from distutils.command.build_py import build_py
from distutils.command.install_data import install_data
except ImportError:
has_sphinx = False

import tests.test_f90nml

# Project details
Expand All @@ -33,57 +23,6 @@
project_scripts = [os.path.join('bin', f) for f in os.listdir('bin')]


# The method below is largely based on Kentaro Wada's implementation in the
# wstools package.
# Reference: https://github.com/vcstools/wstool/blob/master/setup.py
# commit: 8523f7fbe5e0690f0deb785ce54186b41358e31f

# NOTE: setuptools will not explicitly install data and instead packs it inside
# the egg. While this is generally a good practice for modules which rely on
# user data, it makes it impossible to install things like documentation
# outside of the python space.
#
# We get around this by issuing a direct `install_data` command to distutils
# rather than relying on setuptools to install the data into its egg.

# TODO: Should probably also disable the install_data copy to the egg...


# Generate the man page if present
data_files = []
cmd_class = {}
if has_sphinx:
# Create manpage build rule
class ProjectBuildMan(BuildDoc):
def initialize_options(self):
BuildDoc.initialize_options(self)
self.builder = 'man'

# Include build_man into the main builds
class ProjectBuild(build):
def run(self):
self.run_command('build_man')
self.run_command('install_data')
build.run(self)

class ProjectBuildPy(build_py):
def run(self):
self.run_command('build_man')
self.run_command('install_data')
build_py.run(self)

# Tabulate the builds
cmd_class['build'] = ProjectBuild
cmd_class['build_py'] = ProjectBuildPy
cmd_class['build_man'] = ProjectBuildMan

# Try to determine an appropriate man path
if os.path.isdir(os.path.join(sys.prefix, 'share')):
man_root = 'share'
else:
man_root = ''


# Test suite
class ProjectTest(Command):
user_options = []
Expand All @@ -101,8 +40,6 @@ def run(self):
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(not result.wasSuccessful())

cmd_class['test'] = ProjectTest


# README
with open(project_readme_fname) as f:
Expand All @@ -122,8 +59,7 @@ def run(self):
packages = ['f90nml'],
scripts=project_scripts,

data_files=data_files,
cmdclass=cmd_class,
cmdclass = {'test': ProjectTest},

classifiers = [
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit 22b0153

Please sign in to comment.