Exemplo n.º 1
0
def refactor_for_py3(distdir, cy3_dir):
    # need to convert Cython sources first
    import lib2to3.refactor
    from distutils.util import copydir_run_2to3
    fixers = [ fix for fix in lib2to3.refactor.get_fixers_from_package("lib2to3.fixes")
               if fix.split('fix_')[-1] not in ('next',)
               ]
    if not os.path.exists(cy3_dir):
        os.makedirs(cy3_dir)
    import distutils.log as dlog
    dlog.set_threshold(dlog.INFO)
    copydir_run_2to3(distdir, cy3_dir, fixer_names=fixers,
                     template = '''
                     global-exclude *
                     graft Cython
                     recursive-exclude Cython *
                     recursive-include Cython *.py *.pyx *.pxd
                     recursive-include Cython/Debugger/Tests *
                     include runtests.py
                     ''')
    sys.path.insert(0, cy3_dir)

    for keep_2x_file in KEEP_2X_FILES:
        destfile = os.path.join(cy3_dir, keep_2x_file)
        shutil.copy(keep_2x_file, destfile)
Exemplo n.º 2
0
 def run(self):
     build_py_2to3.run(self)
     print("copying aux dirs")
     loglevel = log.set_threshold(log.ERROR)
     for source in ['tools', 'test']:
         dest = os.path.join(self.build_lib, source)
         copydir_run_2to3(source, dest, template=self.manifest_in)
     log.set_threshold(loglevel)
Exemplo n.º 3
0
 def run(self):
     # fix
     print("build_py_2to3")
     build_py_2to3.run(self)
     print("copy/convert test suite")
     loglevel = log.set_threshold(log.ERROR)
     copydir_run_2to3('test', 'test3', template=self.manifest_in)
     log.set_threshold(loglevel)
Exemplo n.º 4
0
 def run(self):
     build_py_2to3.run(self)
     print("copying aux dirs")
     loglevel = log.set_threshold(log.ERROR)
     for source in ['tools', 'test']:
         dest = os.path.join(self.build_lib, source)
         copydir_run_2to3(source, dest, template=self.manifest_in)
     log.set_threshold(loglevel)
Exemplo n.º 5
0
 def run(self):
     # fix
     print("build_py_2to3")
     build_py_2to3.run(self)
     print("copy/convert test suite")
     loglevel = log.set_threshold(log.ERROR)
     copydir_run_2to3('test', 'test3', template=self.manifest_in)
     log.set_threshold(loglevel)
Exemplo n.º 6
0
def refactor_for_py3(distdir, cy3_dir):
    # need to convert Cython sources first
    import lib2to3.refactor
    from distutils.util import copydir_run_2to3
    fixers = [ fix for fix in lib2to3.refactor.get_fixers_from_package("lib2to3.fixes")
               if fix.split('fix_')[-1] not in ('next',)
               ]
    if not os.path.exists(cy3_dir):
        os.makedirs(cy3_dir)
    import distutils.log as dlog
    dlog.set_threshold(dlog.INFO)
    copydir_run_2to3(distdir, cy3_dir, fixer_names=fixers,
                     template = '''
                     global-exclude *
                     graft Cython
                     recursive-exclude Cython *
                     recursive-include Cython *.py *.pyx *.pxd
                     ''')
    sys.path.insert(0, cy3_dir)
Exemplo n.º 7
0
 def run(self):
     build_py_2to3.run(self)
     print("copy/convert test suite")
     loglevel = log.set_threshold(log.ERROR)
     copydir_run_2to3("test", "test3", template=self.manifest_in)
     log.set_threshold(loglevel)
Exemplo n.º 8
0
    This script runs the Sphinx unit test suite.

    :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import sys
from os import path, chdir, listdir

if sys.version_info >= (3, 0):
    print('Copying and converting sources to build/lib/tests...')
    from distutils.util import copydir_run_2to3
    testroot = path.dirname(__file__) or '.'
    newroot = path.join(testroot, path.pardir, 'build')
    newroot = path.join(newroot, listdir(newroot)[0], 'tests')
    copydir_run_2to3(testroot, newroot)
    # switch to the converted dir so nose tests the right tests
    chdir(newroot)

# always test the sphinx package from this directory
sys.path.insert(0, path.join(path.dirname(__file__), path.pardir))

try:
    import nose
except ImportError:
    print("The nose package is needed to run the Sphinx test suite.")
    sys.exit(1)

print("Running Sphinx test suite...")
nose.main()
Exemplo n.º 9
0
Arquivo: runtests.py Projeto: d11/rts
# Fictitious test runner for the project

import sys, os

if sys.version_info > (3,):
    # copy test suite over to "build/lib" and convert it
    from distutils.util import copydir_run_2to3
    testroot = os.path.dirname(__file__)
    newroot = os.path.join(testroot, '..', 'build/lib/test')
    copydir_run_2to3(testroot, newroot)
    # in the following imports, pick up the converted modules
    sys.path[0] = newroot

# run the tests here...

from test_foo import FooTest

import unittest
unittest.main()
Exemplo n.º 10
0
#!/usr/bin/env python3

# $Id $
# Author: Georg Brandl <*****@*****.**>
# Copyright: This module has been placed in the public domain.

"""
Transparently convert the test suite to Python 3 compatible code,
copy it to build/lib, where a converted docutils package is
expected to already be, and run the test suite.
"""

import sys, os

if sys.version_info >= (3,):
    from distutils.util import copydir_run_2to3
    print ('Copying and converting test suite for Python 3 '
           'to build/lib/test...')
    testroot = os.path.dirname(__file__)
    newroot = os.path.join(testroot, '..', 'build/lib/test')
    copydir_run_2to3(testroot, newroot)#, 'prune test_readers/test_python')
    sys.path[0] = newroot

# let the "if __name__ == '__main__'" block execute
exec(open('build/lib/test/alltests.py').read())
Exemplo n.º 11
0
import sys, os
from distutils.core import setup

scripts_dir = 'scripts'
if sys.version_info >= (3,):
    from distutils.util import copydir_run_2to3
    copydir_run_2to3('scripts', 'scripts_ver3')
    scripts_dir = 'scripts_ver3'



setup(name='rst',
      version='.6',
      description='Adds functionality to Docutils XML',
      author='Paul Tremblay',
      # author_email='',
      # url='http://www.python.org/sigs/distutils-sig/',
      # packages=['distutils', 'distutils.command'],
      scripts = [os.path.join(scripts_dir, 'rstxml2xml.py')],
     )
# nothing
Exemplo n.º 12
0
#!/usr/bin/env python3

# $Id $
# Author: Georg Brandl <*****@*****.**>
# Copyright: This module has been placed in the public domain.
"""
Transparently convert the test suite to Python 3 compatible code,
copy it to build/lib, where a converted docutils package is
expected to already be, and run the test suite.
"""

import sys, os

if sys.version_info >= (3, ):
    from distutils.util import copydir_run_2to3
    print('Copying and converting test suite for Python 3 '
          'to build/lib/test...')
    testroot = os.path.dirname(__file__)
    newroot = os.path.join(testroot, '..', 'build/lib/test')
    copydir_run_2to3(testroot, newroot)  #, 'prune test_readers/test_python')
    sys.path[0] = newroot

# let the "if __name__ == '__main__'" block execute
exec(open('build/lib/test/alltests.py').read())