|
14 | 14 | from __future__ import print_function |
15 | 15 |
|
16 | 16 | import os |
17 | | -import sys |
18 | 17 | import os.path as osp |
19 | 18 |
|
20 | 19 | import setuptools # analysis:ignore |
21 | 20 | from distutils.core import setup |
22 | | -from distutils.command.build import build |
23 | 21 |
|
24 | 22 | LIBNAME = 'PythonQwt' |
25 | 23 | PACKAGE_NAME = 'qwt' |
@@ -79,41 +77,6 @@ def get_subpackages(name): |
79 | 77 | return splist |
80 | 78 |
|
81 | 79 |
|
82 | | -try: |
83 | | - import sphinx |
84 | | -except ImportError: |
85 | | - sphinx = None |
86 | | - |
87 | | -from distutils.command.build import build as dftbuild |
88 | | - |
89 | | -class build(dftbuild): |
90 | | - def has_doc(self): |
91 | | - if sphinx is None: |
92 | | - return False |
93 | | - setup_dir = os.path.dirname(os.path.abspath(__file__)) |
94 | | - return os.path.isdir(os.path.join(setup_dir, 'doc')) |
95 | | - sub_commands = dftbuild.sub_commands + [('build_doc', has_doc)] |
96 | | - |
97 | | -cmdclass = {'build' : build} |
98 | | - |
99 | | -if sphinx: |
100 | | - from sphinx.setup_command import BuildDoc |
101 | | - class build_doc(BuildDoc): |
102 | | - def run(self): |
103 | | - # make sure the python path is pointing to the newly built |
104 | | - # code so that the documentation is built on this and not a |
105 | | - # previously installed version |
106 | | - build = self.get_finalized_command('build') |
107 | | - sys.path.insert(0, os.path.abspath(build.build_lib)) |
108 | | - try: |
109 | | - sphinx.setup_command.BuildDoc.run(self) |
110 | | - except UnicodeDecodeError: |
111 | | - print("ERROR: unable to build documentation because Sphinx do not handle source path with non-ASCII characters. Please try to move the source package to another location (path with *only* ASCII characters).", file=sys.stderr) |
112 | | - sys.path.pop(0) |
113 | | - |
114 | | - cmdclass['build_doc'] = build_doc |
115 | | - |
116 | | - |
117 | 80 | setup(name=LIBNAME, version=version, |
118 | 81 | description=DESCRIPTION, long_description=LONG_DESCRIPTION, |
119 | 82 | packages=get_subpackages(PACKAGE_NAME), |
@@ -143,4 +106,4 @@ def run(self): |
143 | 106 | 'Programming Language :: Python :: 2.7', |
144 | 107 | 'Programming Language :: Python :: 3', |
145 | 108 | ], |
146 | | - cmdclass=cmdclass) |
| 109 | + ) |
0 commit comments