|
From: <mi...@us...> - 2020-02-06 12:47:02
|
Revision: 8484
http://sourceforge.net/p/docutils/code/8484
Author: milde
Date: 2020-02-06 12:47:00 +0000 (Thu, 06 Feb 2020)
Log Message:
-----------
setup.py: Switch to setuptools
This removes a lot of distutils overrides we were using in favour of
good old-fashioned 'MANIFEST.in' entries. This appears to generate the
almost the exact same artifacts with the exception of a single new file,
'docutils/writers/latex2e/docutils-05-compat.sty'. However, this file is
referenced from multiple documents, including the LaTeX writer user
guide ('docs/user/latex.txt') and a document describing the file itself
('docs/user/docutils-05-compat.sty.txt'), suggesting this was a mistake
that we're correcting here.
This comparison was made as follows.
1. Create directories to backup artifacts.
$ mkdir -p /tmp/docutils/old
$ mkdir -p /tmp/docutils/new
2. Using the code before this change, build a package and copy it to the
backup directory.
$ virtualenv .venv --python python3.6
$ source .venv/bin/activate
$ cd docutils
$ python setup.py build
$ mv build /tmp/docutils/old/
$ cd -
$ deactivate
$ rm -rf .venv
3. Repeat step 2 but with this change applied, using '/tmp/docutils/new'
as the backup location.
4. Compare the directories.
$ cd /tmp/docutils
$ diff -burq new/build/ old/build/
Only in new/build/lib/docutils/writers/latex2e: docutils-05-compat.sty
5. Repeat steps 2-4 but using the 'python setup.py bdist_wheel' command,
copying the 'dist' directory (rather than the 'build' directory), and
extracting generated wheel using the 'unzip' command.
Signed-off-by: Stephen Finucane <st...@th...>
Modified Paths:
--------------
trunk/docutils/MANIFEST.in
trunk/docutils/setup.py
Modified: trunk/docutils/MANIFEST.in
===================================================================
--- trunk/docutils/MANIFEST.in 2020-02-06 12:46:53 UTC (rev 8483)
+++ trunk/docutils/MANIFEST.in 2020-02-06 12:47:00 UTC (rev 8484)
@@ -20,4 +20,10 @@
recursive-include test/test_transforms *
recursive-include test/test_writers *
recursive-include tools *
+recursive-include docutils/writers *.css
+recursive-include docutils/writers *.gif
+recursive-include docutils/writers *.odt
+recursive-include docutils/writers *.js
+recursive-include docutils/writers *.txt
recursive-exclude * *.pyc *~ .DS_Store
+global-exclude docutils.conf
Modified: trunk/docutils/setup.py
===================================================================
--- trunk/docutils/setup.py 2020-02-06 12:46:53 UTC (rev 8483)
+++ trunk/docutils/setup.py 2020-02-06 12:47:00 UTC (rev 8484)
@@ -4,24 +4,14 @@
from __future__ import print_function
+import glob
+import os
import sys
-import os
-import glob
try:
- import setuptools
+ from setuptools import setup
except ImportError:
- print('Warning: Could not load package `setuptools`.')
- print('Actions requiring `setuptools` instead of `distutils` will fail')
-try:
- from distutils.core import setup, Command
- from distutils.command.build import build
- from distutils.command.build_py import build_py
- from distutils.command.install_data import install_data
- from distutils.util import convert_path
- from distutils import log
-except ImportError:
- print('Error: The "distutils" standard module, which is required for the ')
+ print('Error: The "setuptools" module, which is required for the')
print('installation of Docutils, could not be found. You may need to ')
print('install a package called "python-devel" (or similar) on your ')
print('system using your package manager.')
@@ -28,48 +18,6 @@
sys.exit(1)
-class smart_install_data(install_data):
- # From <http://wiki.python.org/moin/DistutilsInstallDataScattered>,
- # by Pete Shinners.
-
- def run(self):
- # need to change self.install_dir to the library dir
- install_cmd = self.get_finalized_command('install')
- self.install_dir = getattr(install_cmd, 'install_lib')
- return install_data.run(self)
-
-
-class build_data(Command):
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- build_py_cmd = self.get_finalized_command('build_py')
- data_files = self.distribution.data_files
- for f in data_files:
- dir = convert_path(f[0])
- dir = os.path.join(build_py_cmd.build_lib, dir)
- self.mkpath(dir)
- for data in f[1]:
- data = convert_path(data)
- self.copy_file(data, dir)
-
-
-# let our build_data run
-build.sub_commands.append(('build_data', lambda *a: True))
-
-
-s5_theme_files = []
-for dir in glob.glob('docutils/writers/s5_html/themes/*'):
- if os.path.isdir(dir):
- theme_files = glob.glob('%s/*' % dir)
- s5_theme_files.append((dir, theme_files))
-
-
package_data = {
'name': 'docutils',
'description': 'Docutils -- Python Documentation Utilities',
@@ -87,10 +35,7 @@
'license': 'public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)',
'platforms': 'OS-independent',
'python_requires': '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
- 'cmdclass': {
- 'build_data': build_data,
- 'install_data': smart_install_data,
- },
+ 'include_package_data': True,
'package_dir': {
'docutils': 'docutils',
'docutils.tools': 'tools'
@@ -115,28 +60,6 @@
'docutils.writers.xetex',
'docutils.writers.odf_odt',
],
- 'data_files': [
- ('docutils/parsers/rst/include',
- glob.glob('docutils/parsers/rst/include/*.txt')),
- ('docutils/writers/html5_polyglot', [
- 'docutils/writers/html5_polyglot/minimal.css',
- 'docutils/writers/html5_polyglot/plain.css',
- 'docutils/writers/html5_polyglot/math.css',
- 'docutils/writers/html5_polyglot/template.txt']),
- ('docutils/writers/html4css1', [
- 'docutils/writers/html4css1/html4css1.css',
- 'docutils/writers/html4css1/template.txt']),
- ('docutils/writers/latex2e', [
- 'docutils/writers/latex2e/default.tex',
- 'docutils/writers/latex2e/titlepage.tex',
- 'docutils/writers/latex2e/xelatex.tex']),
- ('docutils/writers/pep_html', [
- 'docutils/writers/pep_html/pep.css',
- 'docutils/writers/pep_html/template.txt']),
- ('docutils/writers/s5_html/themes', [
- 'docutils/writers/s5_html/themes/README.txt']),
- ('docutils/writers/odf_odt', ['docutils/writers/odf_odt/styles.odt']),
- ] + s5_theme_files,
'scripts': [
'tools/rst2html.py',
'tools/rst2html4.py',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|