-def SvnExtension(name, *args, **kwargs):
- kwargs["include_dirs"] = ([apr_includedir, apu_includedir] + svn_includedirs +
- ["subvertpy"])
- kwargs["library_dirs"] = svn_libdirs
- # Note that the apr-util link flags are not included here, as
- # subvertpy only uses some apr util constants but does not use
- # the library directly.
- kwargs["extra_link_args"] = apr_link_flags + svn_link_flags
- if os.name == 'nt':
- # on windows, just ignore and overwrite the libraries!
- kwargs["libraries"] = extra_libs
- # APR needs WIN32 defined.
- kwargs["define_macros"] = [("WIN32", None)]
- if sys.platform == 'darwin':
- # on Mac OS X, we need to check for Keychain availability
- if is_keychain_provider_available():
- if "define_macros" not in kwargs:
- kwargs["define_macros"] = []
- kwargs["define_macros"].extend((
- ('DARWIN', None),
- ('SVN_KEYCHAIN_PROVIDER_AVAILABLE', '1'))
- )
- return Extension(name, *args, **kwargs)
-
-
-# On Windows, we install the apr binaries too.
-class install_lib_with_dlls(install_lib):
+
+class SvnExtension(Extension):
+
+ def __init__(self, name, *args, **kwargs):
+ kwargs["include_dirs"] = ([apr_includedir, apu_includedir] +
+ svn_includedirs + ["subvertpy"])
+ kwargs["library_dirs"] = svn_libdirs
+ # Note that the apr-util link flags are not included here, as
+ # subvertpy only uses some apr util constants but does not use
+ # the library directly.
+ kwargs["extra_link_args"] = apr_link_flags + svn_link_flags
+ if os.name == 'nt':
+ # on windows, just ignore and overwrite the libraries!
+ kwargs["libraries"] = extra_libs
+ # APR needs WIN32 defined.
+ kwargs["define_macros"] = [("WIN32", None)]
+ if sys.platform == 'darwin':
+ # on Mac OS X, we need to check for Keychain availability
+ if is_keychain_provider_available():
+ if "define_macros" not in kwargs:
+ kwargs["define_macros"] = []
+ kwargs["define_macros"].extend((
+ ('DARWIN', None),
+ ('SVN_KEYCHAIN_PROVIDER_AVAILABLE', '1'))
+ )
+ Extension.__init__(self, name, *args, **kwargs)
+
+
+class TestCommand(Command):
+ """Command for running unittests without install."""
+
+ user_options = [
+ ("args=", None, '''The command args string passed to '''
+ '''unittest framework, such as --args="-v -f"''')]
+
+ def initialize_options(self):
+ self.args = ''
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ self.run_command('build')
+ bld = self.distribution.get_command_obj('build')
+ # Add build_lib in to sys.path so that unittest can found DLLs and libs
+ sys.path = [os.path.abspath(bld.build_lib)] + sys.path
+ os.chdir(bld.build_lib)
+ log.info("Running unittest without install.")
+
+ import shlex
+ import unittest
+ test_argv0 = [sys.argv[0] + ' test --args=']
+ # For transfering args to unittest, we have to split args
+ # by ourself, so that command like:
+ # python setup.py test --args="-v -f"
+ # can be executed, and the parameter '-v -f' can be
+ # transfering to unittest properly.
+ test_argv = test_argv0 + shlex.split(self.args)
+ unittest.main(module=None, defaultTest='subvertpy.tests.test_suite',
+ argv=test_argv)
+
+
+class BuildWithDLLs(build):