r46942 - Merge sdist-use-7985-4: Use setup.py sdist to build tarballs
hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: hawkowl
Date: Mon Mar 7 20:21:16 2016
New Revision: 46942
Added:
trunk/MANIFEST.in
trunk/twisted/topfiles/7985.feature
Removed:
trunk/bin/admin/build-tarballs
Modified:
trunk/docs/core/development/policy/release-process.rst
trunk/setup.py
trunk/setup3.py
trunk/tox.ini
trunk/twisted/internet/test/fakeendpoint.py
trunk/twisted/plugins/cred_anonymous.py
trunk/twisted/plugins/cred_file.py
trunk/twisted/plugins/cred_memory.py
trunk/twisted/plugins/cred_unix.py
trunk/twisted/plugins/twisted_core.py
trunk/twisted/python/_release.py
trunk/twisted/python/dist.py
trunk/twisted/python/dist3.py
trunk/twisted/python/test/test_dist3.py
trunk/twisted/python/test/test_release.py
trunk/twisted/test/test_twisted.py
Log:
Merge sdist-use-7985-4: Use setup.py sdist to build tarballs
Author: hawkowl
Reviewer: adiroiban
Fixes: #7985
Modified: trunk/docs/core/development/policy/release-process.rst
==============================================================================
--- trunk/docs/core/development/policy/release-process.rst (original)
+++ trunk/docs/core/development/policy/release-process.rst Mon Mar 7 20:21:16 2016
@@ -109,24 +109,19 @@
7. Commit the changes made by build-news - this automatically removes the NEWS topfiles (see #4315)
8. Bump copyright dates in ``LICENSE``, ``twisted/copyright.py``, and ``README`` if required
9. ``git svn dcommit --dry`` to make sure everything looks fine, and then ``git svn dcommit`` to push up the changes.
-10. Make a temporary directory for the tarballs to live in (e.g. ``mkdir /tmp/twisted-release``)
-11. ``Run ./bin/admin/build-tarballs . /tmp/twisted-release/``
-
- - Note: build-tarballs does not produce exactly the same output when run multiple times, even when nothing else has changed.
- If a problem is encountered that requires build-tarballs to be re-run (either during the pre-release or later during the release), care must be taken to avoid releasing two or more different versions of the tarball.
-
-12. Copy ``NEWS`` to ``/tmp/twisted-release/`` as ``NEWS.txt`` for people to view without having to download the tarballs.
+10. Run ``python setup.py sdist -d /tmp/twisted-release`` to build the tarballs.
+11. Copy ``NEWS`` to ``/tmp/twisted-release/`` as ``NEWS.txt`` for people to view without having to download the tarballs.
(e.g. ``cp NEWS /tmp/twisted-release/NEWS.txt``)
-13. Upload the tarballs to ``twistedmatrix.com/Releases/pre/$RELEASE`` (see #4353)
+12. Upload the tarballs to ``twistedmatrix.com/Releases/pre/$RELEASE`` (see #4353)
- You can use ``rsync --rsh=ssh --partial --progress -av /tmp/twisted-release/ [email protected]:/srv/t-web/data/releases/pre/<RELEASE>/`` to do this.
-14. Write the pre-release announcement
+13. Write the pre-release announcement
- Read through the NEWS file and summarize the interesting changes for the release
- Get someone else to look over the announcement before doing it
-15. Announce the pre-release on
+14. Announce the pre-release on
- the twisted-python mailing list
- on IRC in the ``#twisted`` topic
@@ -193,15 +188,14 @@
Cut the tarballs & installers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. Create a new staging area for the release (e.g. ``mkdir /tmp/twisted-release``)
-2. Using a checkout of the release branch or the release tag (with no local changes!), run ``./bin/admin/build-tarballs . /tmp/twisted-release/``
-3. Build Windows MSI
+1. Using a checkout of the release branch or the release tag (with no local changes!), run ``python setup.py sdist -d /tmp/twisted-release`` to build the tarballs.
+2. Build Windows MSI
- http://buildbot.twistedmatrix.com/builders/windows7-64-py2.7-msi
- For "Branch" specify the release branch, e.g. "branches/releases/release-$RELEASE-4290"
- Download the latest .whl files from from http://buildbot.twistedmatrix.com/builds/twisted-packages/ and save them in the staging directory
-4. Sign the tarballs and Windows installers.
+3. Sign the tarballs and Windows installers.
(You will need a PGP key for this - use something like Seahorse to generate one, if you don't have one.)
- MD5: ``md5sum Tw* | gpg -a --clearsign > /tmp/twisted-release/twisted-$RELEASE-md5sums.txt``
Modified: trunk/setup.py
==============================================================================
--- trunk/setup.py (original)
+++ trunk/setup.py Mon Mar 7 20:21:16 2016
@@ -9,18 +9,14 @@
import os
import sys
-
import setuptools
-from pkg_resources import parse_requirements
-
# Tell Twisted not to enforce zope.interface requirement on import, since
# we're going to have to import twisted.python.dist and can rely on
# setuptools to install dependencies.
setuptools._TWISTED_NO_CHECK_REQUIREMENTS = True
-
def main(args):
"""
Invoke twisted.python.dist with the appropriate metadata about the
@@ -35,26 +31,23 @@
if os.path.exists('twisted'):
sys.path.insert(0, '.')
- setup_args = {}
requirements = ["zope.interface >= 3.6.0"]
- setup_args['install_requires'] = requirements
- setup_args['include_package_data'] = True
- setup_args['zip_safe'] = False
-
from twisted.python.dist import (
- STATIC_PACKAGE_METADATA, getDataFiles, getExtensions, getScripts,
- getPackages, setup, _EXTRAS_REQUIRE)
+ STATIC_PACKAGE_METADATA, getExtensions, getScripts,
+ setup, _EXTRAS_REQUIRE)
- scripts = getScripts()
+ setup_args = STATIC_PACKAGE_METADATA.copy()
setup_args.update(dict(
- packages=getPackages('twisted'),
+ packages=setuptools.find_packages(),
+ install_requires=requirements,
conditionalExtensions=getExtensions(),
- scripts=scripts,
+ scripts=getScripts(),
+ include_package_data=True,
+ zip_safe=False,
extras_require=_EXTRAS_REQUIRE,
- data_files=getDataFiles('twisted'),
- **STATIC_PACKAGE_METADATA))
+ ))
setup(**setup_args)
Modified: trunk/setup3.py
==============================================================================
--- trunk/setup3.py (original)
+++ trunk/setup3.py Mon Mar 7 20:21:16 2016
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.3
+#!/usr/bin/env python3
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
@@ -11,40 +11,61 @@
import sys
import os
-from distutils.command.sdist import sdist
+from setuptools import setup, find_packages
+from setuptools.command.build_py import build_py
+from distutils.command.build_scripts import build_scripts
-class DisabledSdist(sdist):
+
+class PickyBuildPy(build_py):
"""
- A version of the sdist command that does nothing.
+ A version of build_py that doesn't install the modules that aren't yet
+ ported to Python 3.
"""
- def run(self):
- sys.stderr.write(
- "The sdist command only works with Python 2 at the moment.\n")
- sys.exit(1)
+ def find_package_modules(self, package, package_dir):
+ from twisted.python.dist3 import modulesToInstall, testDataFiles
+ modules = [
+ module for module
+ in super(build_py, self).find_package_modules(package, package_dir)
+ if ".".join([module[0], module[1]]) in modulesToInstall or
+ ".".join([module[0], module[1]]) in testDataFiles]
+ return modules
-def main():
- from setuptools import setup
+class PickyBuildScripts(build_scripts):
+ """
+ A version of build_scripts which doesn't install the scripts that aren't
+ yet ported to Python 3.
+ """
+ def copy_scripts(self):
+ from twisted.python.dist3 import portedScripts
+ self.scripts = portedScripts
+ return super(PickyBuildScripts, self).copy_scripts()
+
+
+
+def main():
# Make sure the to-be-installed version of Twisted is used, if available,
# since we're importing from it:
if os.path.exists('twisted'):
sys.path.insert(0, '.')
- from twisted.python.dist3 import modulesToInstall
- from twisted.python.dist3 import testDataFiles, _processDataFileList
- from twisted.python.dist import STATIC_PACKAGE_METADATA, getDataFiles
+ from twisted.python.dist import STATIC_PACKAGE_METADATA, getScripts
- _dataFiles = _processDataFileList(testDataFiles)
args = STATIC_PACKAGE_METADATA.copy()
- args['install_requires'] = ["zope.interface >= 4.0.2"]
- args['py_modules'] = modulesToInstall
- args['data_files'] = getDataFiles('twisted') + _dataFiles
- args['zip_safe'] = False
- args['cmdclass'] = {'sdist': DisabledSdist}
- args['scripts'] = ['bin/trial', 'bin/twistd']
+ args.update(dict(
+ cmdclass={
+ 'build_py': PickyBuildPy,
+ 'build_scripts': PickyBuildScripts,
+ },
+ packages=find_packages(),
+ install_requires=["zope.interface >= 4.0.2"],
+ zip_safe=False,
+ include_package_data=True,
+ scripts=getScripts(),
+ ))
setup(**args)
Modified: trunk/tox.ini
==============================================================================
--- trunk/tox.ini (original)
+++ trunk/tox.ini Mon Mar 7 20:21:16 2016
@@ -4,14 +4,12 @@
skip_missing_interpreters=True
toxworkdir=build/
envlist=
- {py27,py33,py34,py35}-{tests,nomodules,coverage}
+ {py27,py33,py34,py35}-{tests,nomodules,coverage}-posix
+ py27-{tests,nomodules,coverage}-windows,
pyflakes,twistedchecker,apidocs,narrativedocs
-skipsdist=True
-
[testenv]
changedir={envtmpdir}
-skip_install=True
deps =
; zope.interface is love, zope.interface is life
zope.interface
@@ -20,7 +18,14 @@
; We cannot use extras here, because it is not supported on Py3
{tests,coverage}: pyopenssl
{tests,coverage}: service_identity
+ {tests,coverage}: idna
+ {tests,coverage}: pyserial
+ {tests,coverage}: python-subunit
{tests,coverage}: pycrypto
+ py27-{tests,coverage}-posix: pysqlite
+ windows: pypiwin32
+
+ py27-{tests,coverage}: soappy
coverage: coverage
@@ -33,8 +38,7 @@
narrativedocs: sphinx
commands =
- py27-{tests,nomodules}: python {toxinidir}/bin/trial {posargs:twisted}
- {py33,py34,py35}-{tests,nomodules}: python {toxinidir}/admin/run-python3-tests {posargs:}
+ {tests,nomodules}: {envbindir}/trial {posargs:twisted}
twistedchecker: twistedchecker {posargs:twisted}
pyflakes: pyflakes {posargs:twisted}
@@ -43,8 +47,7 @@
narrativedocs: sphinx-build -aW -b html -d {toxinidir}/docs/_build {toxinidir}/docs {toxinidir}/docs/_build/
coverage: coverage erase
- py27-coverage: coverage run --rcfile={toxinidir}/.coveragerc {toxinidir}/bin/trial --reporter=bwverbose {posargs:twisted}
- {py33,py34,py35}-coverage: coverage run --rcfile={toxinidir}/.coveragerc {toxinidir}/admin/run-python3-tests --reporter=bwverbose {posargs:}
+ coverage: coverage run --rcfile={toxinidir}/.coveragerc {envbindir}/trial --reporter=bwverbose {posargs:twisted}
coverage: coverage report --rcfile={toxinidir}/.coveragerc
[testenv:twistedchecker]
Modified: trunk/twisted/internet/test/fakeendpoint.py
==============================================================================
--- trunk/twisted/internet/test/fakeendpoint.py (original)
+++ trunk/twisted/internet/test/fakeendpoint.py Mon Mar 7 20:21:16 2016
@@ -6,6 +6,8 @@
Fake client and server endpoint string parser plugins for testing purposes.
"""
+from __future__ import absolute_import, division
+
from zope.interface.declarations import implementer
from twisted.plugin import IPlugin
from twisted.internet.interfaces import (
Modified: trunk/twisted/plugins/cred_anonymous.py
==============================================================================
--- trunk/twisted/plugins/cred_anonymous.py (original)
+++ trunk/twisted/plugins/cred_anonymous.py Mon Mar 7 20:21:16 2016
@@ -7,6 +7,8 @@
Cred plugin for anonymous logins.
"""
+from __future__ import absolute_import, division
+
from zope.interface import implementer
from twisted import plugin
@@ -37,4 +39,3 @@
theAnonymousCheckerFactory = AnonymousCheckerFactory()
-
Modified: trunk/twisted/plugins/cred_file.py
==============================================================================
--- trunk/twisted/plugins/cred_file.py (original)
+++ trunk/twisted/plugins/cred_file.py Mon Mar 7 20:21:16 2016
@@ -7,6 +7,8 @@
Cred plugin for a file of the format 'username:password'.
"""
+from __future__ import absolute_import, division
+
import sys
from zope.interface import implementer
Modified: trunk/twisted/plugins/cred_memory.py
==============================================================================
--- trunk/twisted/plugins/cred_memory.py (original)
+++ trunk/twisted/plugins/cred_memory.py Mon Mar 7 20:21:16 2016
@@ -7,6 +7,8 @@
Cred plugin for an in-memory user database.
"""
+from __future__ import absolute_import, division
+
from zope.interface import implementer
from twisted import plugin
Modified: trunk/twisted/plugins/cred_unix.py
==============================================================================
--- trunk/twisted/plugins/cred_unix.py (original)
+++ trunk/twisted/plugins/cred_unix.py Mon Mar 7 20:21:16 2016
@@ -7,6 +7,8 @@
Cred plugin for UNIX user accounts.
"""
+from __future__ import absolute_import, division
+
from zope.interface import implementer
from twisted import plugin
@@ -134,4 +136,3 @@
theUnixCheckerFactory = UNIXCheckerFactory()
-
Modified: trunk/twisted/plugins/twisted_core.py
==============================================================================
--- trunk/twisted/plugins/twisted_core.py (original)
+++ trunk/twisted/plugins/twisted_core.py Mon Mar 7 20:21:16 2016
@@ -1,6 +1,7 @@
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
+from __future__ import absolute_import, division
from twisted.internet.endpoints import (
_SystemdParser, _TCP6ServerParser, _StandardIOParser,
@@ -10,4 +11,3 @@
tcp6ServerEndpointParser = _TCP6ServerParser()
stdioEndpointParser = _StandardIOParser()
tlsClientEndpointParser = _TLSClientEndpointParser()
-
Modified: trunk/twisted/python/_release.py
==============================================================================
--- trunk/twisted/python/_release.py (original)
+++ trunk/twisted/python/_release.py Mon Mar 7 20:21:16 2016
@@ -15,13 +15,11 @@
import os
import re
import sys
-import tarfile
import textwrap
from zope.interface import Interface, implementer
from datetime import date
-from tempfile import mkdtemp
from subprocess import PIPE, STDOUT, Popen
from twisted.python.versions import Version
@@ -1029,93 +1027,6 @@
-class DistributionBuilder(object):
- """
- A builder of Twisted distributions.
-
- This knows how to build tarballs for Twisted.
- """
-
- def __init__(self, rootDirectory, outputDirectory, templatePath=None):
- """
- Create a distribution builder.
-
- @param rootDirectory: root of a Twisted export which will populate
- subsequent tarballs.
- @type rootDirectory: L{FilePath}.
-
- @param outputDirectory: The directory in which to create the tarballs.
- @type outputDirectory: L{FilePath}
-
- @param templatePath: Path to the template file that is used for the
- howto documentation.
- @type templatePath: L{FilePath}
- """
- self.rootDirectory = rootDirectory
- self.outputDirectory = outputDirectory
- self.templatePath = templatePath
-
-
- def buildTwisted(self, version):
- """
- Build the main Twisted distribution in C{Twisted-<version>.tar.bz2}.
-
- bin/admin is excluded.
-
- @type version: C{str}
- @param version: The version of Twisted to build.
-
- @return: The tarball file.
- @rtype: L{FilePath}.
- """
- releaseName = "Twisted-%s" % (version,)
- buildPath = lambda *args: '/'.join((releaseName,) + args)
-
- outputFile = self.outputDirectory.child(releaseName + ".tar.bz2")
- tarball = tarfile.TarFile.open(outputFile.path, 'w:bz2')
-
- docPath = self.rootDirectory.child("docs")
-
- # Generate docs!
- if docPath.isdir():
- SphinxBuilder().build(docPath)
-
- for binthing in self.rootDirectory.child("bin").children():
- # bin/admin should not be included.
- if binthing.basename() != "admin":
- tarball.add(binthing.path,
- buildPath("bin", binthing.basename()))
-
- for submodule in self.rootDirectory.child("twisted").children():
- if submodule.basename() == "plugins":
- for plugin in submodule.children():
- tarball.add(plugin.path, buildPath("twisted", "plugins",
- plugin.basename()))
- else:
- tarball.add(submodule.path, buildPath("twisted",
- submodule.basename()))
-
- for docDir in self.rootDirectory.child("doc").children():
- if docDir.basename() != "historic":
- tarball.add(docDir.path, buildPath("doc", docDir.basename()))
-
- for toplevel in self.rootDirectory.children():
- if not toplevel.isdir():
- tarball.add(toplevel.path, buildPath(toplevel.basename()))
-
- tarball.close()
-
- return outputFile
-
-
-
-class UncleanWorkingDirectory(Exception):
- """
- Raised when the working directory of a repository is unclean.
- """
-
-
-
class NotWorkingDirectory(Exception):
"""
Raised when a directory does not appear to be a repository directory of a
@@ -1124,50 +1035,6 @@
-def buildAllTarballs(checkout, destination, templatePath=None):
- """
- Build the complete tarball (including documentation) for Twisted.
-
- This should be called after the version numbers have been updated and
- NEWS files created.
-
- @type checkout: L{FilePath}
- @param checkout: The repository from which a pristine source tree will be
- exported.
- @type destination: L{FilePath}
- @param destination: The directory in which tarballs will be placed.
- @type templatePath: L{FilePath}
- @param templatePath: Location of the template file that is used for the
- howto documentation.
-
- @raise UncleanWorkingDirectory: If there are modifications to the
- working directory of C{checkout}.
- @raise NotWorkingDirectory: If the C{checkout} path is not a supported VCS
- repository.
- """
- cmd = getRepositoryCommand(checkout)
- cmd.ensureIsWorkingDirectory(checkout)
-
- if not cmd.isStatusClean(checkout):
- raise UncleanWorkingDirectory(
- "There are local modifications to the repository in %s."
- % (checkout.path,))
-
- workPath = FilePath(mkdtemp())
- export = workPath.child("export")
- cmd.exportTo(checkout, export)
- twistedPath = export.child("twisted")
- version = Project(twistedPath).getVersion()
- versionString = version.base()
-
- if not destination.exists():
- destination.createDirectory()
- db = DistributionBuilder(export, destination, templatePath=templatePath)
- db.buildTwisted(versionString)
- workPath.remove()
-
-
-
class ChangeVersionsScriptOptions(Options):
"""
Options for L{ChangeVersionsScript}.
@@ -1204,36 +1071,6 @@
-class BuildTarballsScript(object):
- """
- A thing for building release tarballs. See L{main}.
- """
- buildAllTarballs = staticmethod(buildAllTarballs)
-
- def main(self, args):
- """
- Build all release tarballs.
-
- @type args: list of C{str}
- @param args: The command line arguments to process. This must contain
- at least two strings: the checkout directory and the destination
- directory. An optional third string can be specified for the
- website template file, used for building the howto documentation.
- If this string isn't specified, the default template included in
- twisted will be used.
- """
- if len(args) < 2 or len(args) > 3:
- sys.exit("Must specify at least two arguments: "
- "Twisted checkout and destination path. The optional "
- "third argument is the website template path.")
- if len(args) == 2:
- self.buildAllTarballs(FilePath(args[0]), FilePath(args[1]))
- elif len(args) == 3:
- self.buildAllTarballs(FilePath(args[0]), FilePath(args[1]),
- FilePath(args[2]))
-
-
-
class BuildAPIDocsScript(object):
"""
A thing for building API documentation. See L{main}.
Modified: trunk/twisted/python/dist.py
==============================================================================
--- trunk/twisted/python/dist.py (original)
+++ trunk/twisted/python/dist.py Mon Mar 7 20:21:16 2016
@@ -26,15 +26,15 @@
as setuptools version specifiers, used to populate L{_EXTRAS_REQUIRE}.
"""
-from distutils.command import build_scripts, install_data, build_ext
-from distutils.errors import CompileError
-from distutils import core
-from distutils.core import Extension
-import fnmatch
import os
import platform
import sys
+from distutils.command import build_scripts, build_ext
+from distutils.errors import CompileError
+from setuptools import setup as _setup
+from setuptools import Extension
+
from twisted import copyright
from twisted.python.compat import execfile
@@ -129,21 +129,12 @@
@param conditionalExtensions: Extensions to optionally build.
@type conditionalExtensions: C{list} of L{ConditionalExtension}
"""
- return core.setup(**get_setup_args(**kw))
+ return _setup(**get_setup_args(**kw))
def get_setup_args(**kw):
- if 'plugins' in kw:
- py_modules = []
- for plg in kw['plugins']:
- py_modules.append("twisted.plugins." + plg)
- kw.setdefault('py_modules', []).extend(py_modules)
- del kw['plugins']
-
if 'cmdclass' not in kw:
- kw['cmdclass'] = {
- 'install_data': install_data_twisted,
- 'build_scripts': build_scripts_twisted}
+ kw['cmdclass'] = {'build_scripts': build_scripts_twisted}
if "conditionalExtensions" in kw:
extensions = kw["conditionalExtensions"]
@@ -180,88 +171,6 @@
return ns['version'].base()
-# Names that are excluded from globbing results:
-EXCLUDE_NAMES = ["{arch}", "CVS", ".cvsignore", "_darcs",
- "RCS", "SCCS", ".svn"]
-EXCLUDE_PATTERNS = ["*.py[cdo]", "*.s[ol]", ".#*", "*~", "*.py"]
-
-
-def _filterNames(names):
- """
- Given a list of file names, return those names that should be copied.
- """
- names = [n for n in names
- if n not in EXCLUDE_NAMES]
- # This is needed when building a distro from a working
- # copy (likely a checkout) rather than a pristine export:
- for pattern in EXCLUDE_PATTERNS:
- names = [n for n in names
- if (not fnmatch.fnmatch(n, pattern))
- and (not n.endswith('.py'))]
- return names
-
-
-def relativeTo(base, relativee):
- """
- Gets 'relativee' relative to 'basepath'.
-
- i.e.,
-
- >>> relativeTo('/home/', '/home/radix/')
- 'radix'
- >>> relativeTo('.', '/home/radix/Projects/Twisted') # curdir is /home/radix
- 'Projects/Twisted'
-
- The 'relativee' must be a child of 'basepath'.
- """
- basepath = os.path.abspath(base)
- relativee = os.path.abspath(relativee)
- if relativee.startswith(basepath):
- relative = relativee[len(basepath):]
- if relative.startswith(os.sep):
- relative = relative[1:]
- return os.path.join(base, relative)
- raise ValueError("%s is not a subpath of %s" % (relativee, basepath))
-
-
-def getDataFiles(dname, ignore=None, parent=None):
- """
- Get all the data files that should be included in this distutils Project.
-
- 'dname' should be the path to the package that you're distributing.
-
- 'ignore' is a list of sub-packages to ignore. This facilitates
- disparate package hierarchies. That's a fancy way of saying that
- the 'twisted' package doesn't want to include the 'twisted.conch'
- package, so it will pass ['conch'] as the value.
-
- 'parent' is necessary if you're distributing a subpackage like
- twisted.conch. 'dname' should point to 'twisted/conch' and 'parent'
- should point to 'twisted'. This ensures that your data_files are
- generated correctly, only using relative paths for the first element
- of the tuple ('twisted/conch/*').
- The default 'parent' is the current working directory.
- """
- parent = parent or "."
- ignore = ignore or []
- result = []
- for directory, subdirectories, filenames in os.walk(dname):
- resultfiles = []
- for exname in EXCLUDE_NAMES:
- if exname in subdirectories:
- subdirectories.remove(exname)
- for ig in ignore:
- if ig in subdirectories:
- subdirectories.remove(ig)
- for filename in _filterNames(filenames):
- resultfiles.append(filename)
- if resultfiles:
- result.append((relativeTo(parent, directory),
- [relativeTo(parent,
- os.path.join(directory, filename))
- for filename in resultfiles]))
- return result
-
def getExtensions():
"""
@@ -295,36 +204,6 @@
-def getPackages(dname, pkgname=None, results=None, ignore=None, parent=None):
- """
- Get all packages which are under dname. This is necessary for
- Python 2.2's distutils. Pretty similar arguments to getDataFiles,
- including 'parent'.
- """
- parent = parent or ""
- prefix = []
- if parent:
- prefix = [parent]
- bname = os.path.basename(dname)
- ignore = ignore or []
- if bname in ignore:
- return []
- if results is None:
- results = []
- if pkgname is None:
- pkgname = []
- subfiles = os.listdir(dname)
- abssubfiles = [os.path.join(dname, x) for x in subfiles]
- if '__init__.py' in subfiles:
- results.append(prefix + pkgname + [bname])
- for subdir in filter(os.path.isdir, abssubfiles):
- getPackages(subdir, pkgname=pkgname + [bname],
- results=results, ignore=ignore,
- parent=parent)
- res = ['.'.join(result) for result in results]
- return res
-
-
def getScripts(basedir=''):
"""
Returns a list of scripts for Twisted.
@@ -340,8 +219,8 @@
for specialExclusion in ['.svn', '_preamble.py', '_preamble.pyc']:
if specialExclusion in thingies:
thingies.remove(specialExclusion)
- return filter(os.path.isfile,
- [os.path.join(scriptdir, x) for x in thingies])
+ return list(filter(os.path.isfile,
+ [os.path.join(scriptdir, x) for x in thingies]))
## Helpers and distutil tweaks
@@ -364,18 +243,6 @@
-class install_data_twisted(install_data.install_data):
- """
- I make sure data files are installed in the package directory.
- """
- def finalize_options(self):
- self.set_undefined_options('install',
- ('install_lib', 'install_dir')
- )
- install_data.install_data.finalize_options(self)
-
-
-
class build_ext_twisted(build_ext.build_ext):
"""
Allow subclasses to easily detect and customize Extensions to
Modified: trunk/twisted/python/dist3.py
==============================================================================
--- trunk/twisted/python/dist3.py (original)
+++ trunk/twisted/python/dist3.py Mon Mar 7 20:21:16 2016
@@ -33,38 +33,36 @@
from __future__ import division
-from os import path
-
modules = [
- "twisted",
+ "twisted.__init__",
"twisted._version",
- "twisted.application",
+ "twisted.application.__init__",
"twisted.application.app",
"twisted.application.internet",
"twisted.application.reactors",
"twisted.application.service",
"twisted.application.strports",
- "twisted.application.test",
- "twisted.conch",
+ "twisted.application.test.__init__",
+ "twisted.conch.__init__",
"twisted.conch.checkers",
"twisted.conch.error",
- "twisted.conch.ssh",
+ "twisted.conch.ssh.__init__",
"twisted.conch.ssh._cryptography_backports",
"twisted.conch.ssh.common",
"twisted.conch.ssh.keys",
"twisted.conch.ssh.sexpy",
- "twisted.conch.test",
+ "twisted.conch.test.__init__",
"twisted.copyright",
- "twisted.cred",
+ "twisted.cred.__init__",
"twisted.cred._digest",
"twisted.cred.checkers",
"twisted.cred.credentials",
"twisted.cred.error",
"twisted.cred.portal",
"twisted.cred.strcred",
- "twisted.cred.test",
- "twisted.internet",
+ "twisted.cred.test.__init__",
+ "twisted.internet.__init__",
"twisted.internet._baseprocess",
"twisted.internet._glibbase",
"twisted.internet._newtls",
@@ -97,16 +95,17 @@
"twisted.internet.stdio",
"twisted.internet.task",
"twisted.internet.tcp",
- "twisted.internet.test",
+ "twisted.internet.test.__init__",
"twisted.internet.test._posixifaces",
"twisted.internet.test.connectionmixins",
+ "twisted.internet.test.fakeendpoint",
"twisted.internet.test.modulehelpers",
"twisted.internet.test.reactormixins",
"twisted.internet.threads",
"twisted.internet.udp",
"twisted.internet.unix",
"twisted.internet.utils",
- "twisted.logger",
+ "twisted.logger.__init__",
"twisted.logger._buffer",
"twisted.logger._file",
"twisted.logger._filter",
@@ -121,8 +120,8 @@
"twisted.logger._observer",
"twisted.logger._stdlib",
"twisted.logger._util",
- "twisted.logger.test",
- "twisted.names",
+ "twisted.logger.test.__init__",
+ "twisted.names.__init__",
"twisted.names._rfc1982",
"twisted.names.cache",
"twisted.names.client",
@@ -131,29 +130,34 @@
"twisted.names.error",
"twisted.names.hosts",
"twisted.names.resolve",
- "twisted.names.test",
- "twisted.persisted",
+ "twisted.names.test.__init__",
+ "twisted.persisted.__init__",
"twisted.persisted.aot",
"twisted.persisted.crefutil",
"twisted.persisted.sob",
"twisted.persisted.styles",
"twisted.plugin",
- "twisted.plugins",
+ "twisted.plugins.__init__",
+ "twisted.plugins.cred_anonymous",
+ "twisted.plugins.cred_file",
+ "twisted.plugins.cred_memory",
"twisted.plugins.cred_sshkeys",
+ "twisted.plugins.cred_unix",
+ "twisted.plugins.twisted_core",
"twisted.plugins.twisted_trial",
"twisted.plugins.twisted_web",
- "twisted.positioning",
+ "twisted.positioning.__init__",
"twisted.positioning._sentence",
"twisted.positioning.base",
"twisted.positioning.ipositioning",
"twisted.positioning.nmea",
- "twisted.protocols",
+ "twisted.protocols.__init__",
"twisted.protocols.amp",
"twisted.protocols.basic",
"twisted.protocols.policies",
- "twisted.protocols.test",
+ "twisted.protocols.test.__init__",
"twisted.protocols.tls",
- "twisted.python",
+ "twisted.python.__init__",
"twisted.python._tzhelper",
"twisted.python._url",
"twisted.python.compat",
@@ -187,15 +191,15 @@
"twisted.python.util",
"twisted.python.versions",
"twisted.python.zippath",
- "twisted.scripts",
+ "twisted.scripts.__init__",
"twisted.scripts._twistd_unix",
"twisted.scripts.trial",
"twisted.scripts.twistd",
- "twisted.test",
+ "twisted.test.__init__",
"twisted.test.iosim",
"twisted.test.proto_helpers",
"twisted.test.ssl_helpers",
- "twisted._threads",
+ "twisted._threads.__init__",
"twisted._threads._convenience",
"twisted._threads._ithreads",
"twisted._threads._memory",
@@ -209,7 +213,7 @@
"twisted.trial.itrial",
"twisted.trial.reporter",
"twisted.trial.runner",
- "twisted.trial.test",
+ "twisted.trial.test.__init__",
"twisted.trial.test.detests",
"twisted.trial.test.erroneous",
"twisted.trial.test.packages",
@@ -218,7 +222,7 @@
"twisted.trial.test.suppression",
"twisted.trial.unittest",
"twisted.trial.util",
- "twisted.web",
+ "twisted.web.__init__",
"twisted.web._auth",
"twisted.web._auth.basic",
"twisted.web._auth.digest",
@@ -238,7 +242,7 @@
"twisted.web.static",
"twisted.web.tap",
"twisted.web.template",
- "twisted.web.test",
+ "twisted.web.test.__init__",
"twisted.web.test.requesthelper",
"twisted.web.util",
"twisted.web.vhost",
@@ -457,6 +461,10 @@
"twisted.trial.test.packages",
"twisted.trial.test.sample",
"twisted.trial.test.scripttest",
+ "twisted.trial.test.weird",
+ "twisted.trial.test.mockcustomsuite",
+ "twisted.trial.test.mockcustomsuite2",
+ "twisted.trial.test.mockcustomsuite3",
]
@@ -495,30 +503,6 @@
"twisted.web.server",
]
-
-def _processDataFileList(dataFiles):
- """
- Turn a list of file names into a format that distutils likes.
-
- For example:
-
- ["foo/bar.py", "baz/spam.py"]
-
- ...is transformed into...
-
- [("foo", ["foo/bar.py"]), ("baz", "baz/spam.py")]
- """
- files = {}
-
- for file in dataFiles:
- pathFragments = file.split(".")
- targetDir = path.sep.join(pathFragments[:-1])
-
- if not files.get(targetDir):
- files[targetDir] = []
- files[targetDir].append(path.sep.join(pathFragments) + ".py")
-
- return list(files.items())
-
-
modulesToInstall = modules + testModules + almostModules
+
+portedScripts = ["bin/trial", "bin/twistd"]
Modified: trunk/twisted/python/test/test_dist3.py
==============================================================================
--- trunk/twisted/python/test/test_dist3.py (original)
+++ trunk/twisted/python/test/test_dist3.py Mon Mar 7 20:21:16 2016
@@ -11,8 +11,7 @@
import twisted
from twisted.trial.unittest import TestCase
-from twisted.python.dist3 import modulesToInstall
-from twisted.python.dist3 import testDataFiles, _processDataFileList
+from twisted.python.dist3 import modulesToInstall, testDataFiles
class ModulesToInstallTests(TestCase):
@@ -51,20 +50,3 @@
for file in testDataFiles:
self.assertTrue(os.path.exists(
os.path.join(root, os.path.sep.join(file.split(".")) + ".py")))
-
-
- def test_processDataFileList(self):
- """
- L{_processDataFileList} translates a list of files into a distutils
- friendly format.
- """
- result = _processDataFileList(["foo.bar", "foo.baz.bar",
- "foo.z", "baz.spam"])
- self.assertIn(("foo", [os.path.sep.join(["foo", "bar.py"]),
- os.path.sep.join(["foo", "z.py"])]),
- result)
- self.assertIn((os.path.sep.join(["foo", "baz"]),
- [os.path.sep.join(["foo", "baz", "bar.py"])]),
- result)
- self.assertIn(("baz", [os.path.sep.join(["baz", "spam.py"])]),
- result)
Modified: trunk/twisted/python/test/test_release.py
==============================================================================
--- trunk/twisted/python/test/test_release.py (original)
+++ trunk/twisted/python/test/test_release.py Mon Mar 7 20:21:16 2016
@@ -15,7 +15,6 @@
import textwrap
import tempfile
import shutil
-import tarfile
from datetime import date
from io import BytesIO as StringIO
@@ -32,9 +31,9 @@
_changeVersionInFile, getNextVersion, findTwistedProjects, replaceInFile,
replaceProjectVersion, Project, generateVersionFileData,
changeAllProjectVersions, VERSION_OFFSET, filePathDelta, CommandFailed,
- DistributionBuilder, APIBuilder, BuildAPIDocsScript, buildAllTarballs,
- runCommand, UncleanWorkingDirectory, NotWorkingDirectory,
- ChangeVersionsScript, BuildTarballsScript, NewsBuilder, SphinxBuilder,
+ APIBuilder, BuildAPIDocsScript,
+ runCommand, NotWorkingDirectory,
+ ChangeVersionsScript, NewsBuilder, SphinxBuilder,
GitCommand, SVNCommand, getRepositoryCommand, IVCSCommand)
if os.name != 'posix':
@@ -186,24 +185,6 @@
% (root.path, children))
- def assertExtractedStructure(self, outputFile, dirDict):
- """
- Assert that a tarfile content is equivalent to one described by a dict.
-
- @param outputFile: The tar file built by L{DistributionBuilder}.
- @type outputFile: L{FilePath}.
- @param dirDict: The dict that should describe the contents of the
- directory. It should be the same structure as the C{dirDict}
- parameter to L{createStructure}.
- @type dirDict: C{dict}
- """
- tarFile = tarfile.TarFile.open(outputFile.path, "r:bz2")
- extracted = FilePath(self.mktemp())
- for info in tarFile:
- tarFile.extract(info, path=extracted.path)
- self.assertStructure(extracted.children()[0], dirDict)
-
-
class ChangeVersionTests(ExternalTempdirTestCase, StructureAssertingMixin):
"""
@@ -1517,283 +1498,6 @@
-class DistributionBuilderTestBase(StructureAssertingMixin,
- ExternalTempdirTestCase):
- """
- Base for tests of L{DistributionBuilder}.
- """
-
- def setUp(self):
- self.rootDir = FilePath(self.mktemp())
- self.outputDir = FilePath(self.mktemp())
- self.builder = DistributionBuilder(self.rootDir, self.outputDir)
-
-
-
-class DistributionBuilderTests(DistributionBuilderTestBase):
-
- def test_twistedDistribution(self):
- """
- The Twisted tarball contains everything in the source checkout, with
- built documentation.
- """
- manInput1 = "pretend there's some troff in here or something"
- structure = {
- "README.rst": "Twisted",
- "unrelated": "x",
- "LICENSE": "copyright!",
- "setup.py": "import toplevel",
- "bin": {"web": {"websetroot": "SET ROOT"},
- "twistd": "TWISTD"},
- "twisted": {
- "web": {
- "__init__.py": "import WEB",
- "topfiles": {"setup.py": "import WEBINSTALL",
- "README": "WEB!"}},
- "words": {"__init__.py": "import WORDS"},
- "plugins": {"twisted_web.py": "import WEBPLUG",
- "twisted_words.py": "import WORDPLUG"}},
- "docs": {
- "conf.py": testingSphinxConf,
- "index.rst": "",
- "core": {"man": {"twistd.1": manInput1}}
- }
- }
-
- def hasManpagesAndSphinx(path):
- self.assertTrue(path.isdir())
- self.assertEqual(
- path.child("core").child("man").child("twistd.1").getContent(),
- manInput1
- )
- return True
-
- outStructure = {
- "README.rst": "Twisted",
- "unrelated": "x",
- "LICENSE": "copyright!",
- "setup.py": "import toplevel",
- "bin": {"web": {"websetroot": "SET ROOT"},
- "twistd": "TWISTD"},
- "twisted": {
- "web": {"__init__.py": "import WEB",
- "topfiles": {"setup.py": "import WEBINSTALL",
- "README": "WEB!"}},
- "words": {"__init__.py": "import WORDS"},
- "plugins": {"twisted_web.py": "import WEBPLUG",
- "twisted_words.py": "import WORDPLUG"}},
- "doc": hasManpagesAndSphinx,
- }
-
- self.createStructure(self.rootDir, structure)
-
- outputFile = self.builder.buildTwisted("10.0.0")
-
- self.assertExtractedStructure(outputFile, outStructure)
-
- test_twistedDistribution.skip = sphinxSkip
-
-
- def test_excluded(self):
- """
- bin/admin and doc/historic are excluded from the Twisted tarball.
- """
- structure = {
- "bin": {"admin": {"blah": "ADMIN"},
- "twistd": "TWISTD"},
- "twisted": {
- "web": {
- "__init__.py": "import WEB",
- "topfiles": {"setup.py": "import WEBINSTALL",
- "README": "WEB!"}}},
- "doc": {"historic": {"hello": "there"},
- "other": "contents"}}
-
- outStructure = {
- "bin": {"twistd": "TWISTD"},
- "twisted": {
- "web": {
- "__init__.py": "import WEB",
- "topfiles": {"setup.py": "import WEBINSTALL",
- "README": "WEB!"}}},
- "doc": {"other": "contents"}}
-
- self.createStructure(self.rootDir, structure)
- outputFile = self.builder.buildTwisted("10.0.0")
- self.assertExtractedStructure(outputFile, outStructure)
-
-
- def test_setup3(self):
- """
- setup3.py is included in the release tarball.
- """
- structure = {
- "setup3.py": "install python 3 version",
- "bin": {"twistd": "TWISTD"},
- "twisted": {
- "web": {
- "__init__.py": "import WEB",
- "topfiles": {"setup.py": "import WEBINSTALL",
- "README": "WEB!"}}},
- "doc": {"web": {"howto": {"index.html": "hello"}}},
- }
-
- self.createStructure(self.rootDir, structure)
- outputFile = self.builder.buildTwisted("13.2.0")
- self.assertExtractedStructure(outputFile, structure)
-
-
-
-class BuildAllTarballsTestBase(object):
- """
- Tests for L{DistributionBuilder.buildAllTarballs}.
- """
-
- def test_buildAllTarballs(self):
- """
- L{buildAllTarballs} builds tarballs for Twisted and all of its
- subprojects based on a Git repository; the resulting tarballs contain
- no Git metadata. This involves building documentation, which it will
- build with the correct API documentation reference base URL.
- """
- checkoutPath = self.mktemp()
- checkout = FilePath(checkoutPath)
- self.outputDir.remove()
-
- self._init(checkout)
-
- structure = {
- "README.rst": "Twisted",
- "unrelated": "x",
- "LICENSE": "copyright!",
- "setup.py": "import toplevel",
- "bin": {"words": {"im": "import im"},
- "twistd": "TWISTD"},
- "twisted": {
- "topfiles": {"setup.py": "import TOPINSTALL",
- "README": "CORE!"},
- "_version.py": genVersion("twisted", 1, 2, 0),
- "words": {"__init__.py": "import WORDS",
- "_version.py": genVersion("twisted.words", 1, 2, 0),
- "topfiles": {"setup.py": "import WORDSINSTALL",
- "README": "WORDS!"}},
- "plugins": {"twisted_web.py": "import WEBPLUG",
- "twisted_words.py": "import WORDPLUG",
- "twisted_yay.py": "import YAY"}},
- "docs": {
- "conf.py": testingSphinxConf,
- "index.rst": "",
- }
- }
-
- def smellsLikeSphinxOutput(actual):
- self.assertTrue(actual.isdir())
- self.assertIn("index.html", actual.listdir())
- self.assertIn("objects.inv", actual.listdir())
- return True
-
- twistedStructure = {
- "README.rst": "Twisted",
- "unrelated": "x",
- "LICENSE": "copyright!",
- "setup.py": "import toplevel",
- "bin": {"twistd": "TWISTD",
- "words": {"im": "import im"}},
- "twisted": {
- "topfiles": {"setup.py": "import TOPINSTALL",
- "README": "CORE!"},
- "_version.py": genVersion("twisted", 1, 2, 0),
- "words": {"__init__.py": "import WORDS",
- "_version.py": genVersion("twisted.words", 1, 2, 0),
- "topfiles": {"setup.py": "import WORDSINSTALL",
- "README": "WORDS!"}},
- "plugins": {"twisted_web.py": "import WEBPLUG",
- "twisted_words.py": "import WORDPLUG",
- "twisted_yay.py": "import YAY"}},
- "doc": smellsLikeSphinxOutput}
-
- self.createStructure(checkout, structure)
- childs = [x.path for x in checkout.children()]
- self._addAndCommit(checkout, childs)
-
- buildAllTarballs(checkout, self.outputDir)
- self.assertEqual(
- set(self.outputDir.children()),
- set([self.outputDir.child("Twisted-1.2.0.tar.bz2")]))
-
- self.assertExtractedStructure(
- self.outputDir.child("Twisted-1.2.0.tar.bz2"),
- twistedStructure)
-
-
- def test_buildAllTarballsEnsuresCleanCheckout(self):
- """
- L{UncleanWorkingDirectory} is raised by L{buildAllTarballs} when the
- Git repository provided has uncommitted changes.
- """
- checkoutPath = self.mktemp()
- checkout = FilePath(checkoutPath)
-
- self._init(checkout)
-
- checkout.child("foo").setContent("whatever")
- self.assertRaises(UncleanWorkingDirectory,
- buildAllTarballs, checkout, FilePath(self.mktemp()))
-
-
- def test_buildAllTarballsEnsuresExistingCheckout(self):
- """
- L{NotWorkingDirectory} is raised by L{buildAllTarballs} when the
- checkout passed does not exist or is not a Git repository.
- """
- checkout = FilePath(self.mktemp()).child("test")
- self.assertRaises(NotWorkingDirectory,
- buildAllTarballs,
- checkout, FilePath(self.mktemp()))
- checkout.createDirectory()
- self.assertRaises(NotWorkingDirectory,
- buildAllTarballs,
- checkout, FilePath(self.mktemp()))
-
-
-
-class BuildAllTarballsGitTestCase(DistributionBuilderTestBase,
- BuildAllTarballsTestBase):
- """
- Tests for L{DistributionBuilder.buildAllTarballs} using Git.
- """
- skip = gitSkip or sphinxSkip
-
- def _init(self, directory):
- _gitInit(directory)
-
- def _addAndCommit(self, checkout, files):
- runCommand(["git", "-C", checkout.path, "add", "-f"] + files)
- runCommand(["git", "-C", checkout.path, "commit", "-m", "yay"])
-
-
-
-class BuildAllTarballsSVNTestCase(DistributionBuilderTestBase,
- BuildAllTarballsTestBase):
- """
- Tests for L{DistributionBuilder.buildAllTarballs} using SVN.
- """
- skip = svnSkip or sphinxSkip
-
- def _init(self, directory):
- repositoryPath = self.mktemp()
- repository = FilePath(repositoryPath)
-
- runCommand(["svnadmin", "create", repository.path])
- runCommand(["svn", "checkout", "file://" + repository.path,
- directory.path])
-
- def _addAndCommit(self, checkout, files):
- runCommand(["svn", "add"] + files)
- runCommand(["svn", "commit", checkout.path, "-m", "yay"])
-
-
-
class ScriptTests(StructureAssertingMixin, ExternalTempdirTestCase):
"""
Tests for the release script functionality.
@@ -1884,52 +1588,6 @@
["my united.states.of prewhatever"])
- def test_buildTarballsScript(self):
- """
- L{BuildTarballsScript.main} invokes L{buildAllTarballs} with
- 2 or 3 L{FilePath} instances representing the paths passed to it.
- """
- builds = []
-
- def myBuilder(checkout, destination, template=None):
- builds.append((checkout, destination, template))
-
- tarballBuilder = BuildTarballsScript()
- tarballBuilder.buildAllTarballs = myBuilder
-
- tarballBuilder.main(["checkoutDir", "destinationDir"])
- self.assertEqual(
- builds,
- [(FilePath("checkoutDir"), FilePath("destinationDir"), None)])
-
- builds = []
- tarballBuilder.main(["checkoutDir", "destinationDir", "templatePath"])
- self.assertEqual(
- builds,
- [(FilePath("checkoutDir"), FilePath("destinationDir"),
- FilePath("templatePath"))])
-
-
- def test_defaultBuildTarballsScriptBuilder(self):
- """
- The default implementation of L{BuildTarballsScript.buildAllTarballs}
- is L{buildAllTarballs}.
- """
- tarballBuilder = BuildTarballsScript()
- self.assertEqual(tarballBuilder.buildAllTarballs, buildAllTarballs)
-
-
- def test_badNumberOfArgumentsToBuildTarballs(self):
- """
- L{BuildTarballsScript.main} raises SystemExit when the wrong number of
- arguments are passed.
- """
- tarballBuilder = BuildTarballsScript()
- self.assertRaises(SystemExit, tarballBuilder.main, [])
- self.assertRaises(SystemExit, tarballBuilder.main,
- ["a", "b", "c", "d"])
-
-
def test_badNumberOfArgumentsToBuildNews(self):
"""
L{NewsBuilder.main} raises L{SystemExit} when other than 1 argument is
Modified: trunk/twisted/test/test_twisted.py
==============================================================================
--- trunk/twisted/test/test_twisted.py (original)
+++ trunk/twisted/test/test_twisted.py Mon Mar 7 20:21:16 2016
@@ -671,9 +671,11 @@
"twisted.{}._version".format(self.subproject))
-
-subprojects = ["mail", "conch", "runner", "web", "words", "names", "news",
- "pair"]
+if _PY3:
+ subprojects = ["conch", "web", "names"]
+else:
+ subprojects = ["mail", "conch", "runner", "web", "words", "names", "news",
+ "pair"]
for subproject in subprojects:
_______________________________________________
Twisted-commits mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-commits