forked from pool/python-pysvn
65 lines
2.5 KiB
Python
65 lines
2.5 KiB
Python
"""
|
|
This wrapper makes pysvn build/install process distutils compatible.
|
|
Mikhail Terekhov <termim@gmail.com>
|
|
"""
|
|
|
|
from distutils.command.build_ext import build_ext as _build_ext
|
|
from distutils.core import setup, Extension
|
|
import sys, os, os.path, subprocess
|
|
|
|
class build_ext(_build_ext):
|
|
def build_extension(self, ext):
|
|
sources = ext.sources[0]
|
|
fullname = self.get_ext_fullname(ext.name)
|
|
modpath = fullname.split('.')
|
|
package = '.'.join(modpath[:-1])
|
|
base = modpath[-1]
|
|
build_py = self.get_finalized_command('build_py')
|
|
package_dir = build_py.get_package_dir(package)
|
|
ext_filename = os.path.join(package_dir, self.get_ext_filename(base))
|
|
outfile = os.path.join(self.build_lib, *modpath[:-1])
|
|
outfile = os.path.join(outfile,self.get_ext_filename(base))
|
|
sys.path.insert(0,sources)
|
|
import setup as msetup
|
|
curdir = os.path.abspath(os.curdir)
|
|
try:
|
|
os.chdir(sources)
|
|
msetup.main(['','configure'])
|
|
subprocess.call('make')
|
|
finally:
|
|
os.chdir(curdir)
|
|
|
|
self.copy_file(ext_filename, outfile, preserve_mode=True)
|
|
|
|
docs = [os.path.join('Docs',x) for x in os.listdir('Docs')]
|
|
examples = [os.path.join('Examples/Client',x) for x in os.listdir('Examples/Client')]
|
|
|
|
setup(name='pysvn',
|
|
version='1.0',
|
|
url = 'http://pysvn.tigris.org/',
|
|
author = 'Barry Scott',
|
|
author_email = 'barryscott@tigris.org',
|
|
description = "Highlevel and easy to use Python bindings to Subversion",
|
|
long_description =
|
|
"The pysvn project's goal is to enable Tools to be written in Python that use Subversion. "
|
|
"Windows, Mac OS X, Linux and other unix platforms are supported.",
|
|
|
|
cmdclass={'build_ext': build_ext},
|
|
packages = ['pysvn'],
|
|
package_dir = {'pysvn': 'Source/pysvn'},
|
|
data_files = [('share/doc/packages/python-pysvn', docs),
|
|
('share/doc/packages/python-pysvn/Examples/Client', examples)],
|
|
ext_modules=[Extension('pysvn._pysvn_%d_%d' % sys.version_info[:2], ['Source']),],
|
|
|
|
classifiers=[
|
|
'License :: Apache License',
|
|
'Development Status :: 5 - Production/Stable',
|
|
'Programming Language :: Python',
|
|
'Intended Audience :: Developers',
|
|
'Operating System :: MacOS :: MacOS X',
|
|
'Operating System :: Microsoft :: Windows',
|
|
'Operating System :: POSIX',
|
|
'Topic :: Software Development :: Version Control',
|
|
],
|
|
)
|