[Erp5-report] r40626 kazuhiko - in /erp5/trunk/utils/pysvn: ./ Source/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 24 22:23:29 CET 2010


Author: kazuhiko
Date: Wed Nov 24 22:23:28 2010
New Revision: 40626

URL: http://svn.erp5.org?rev=40626&view=rev
Log:
heavily patched version that supports --include-dirs and --library-dirs

Modified:
    erp5/trunk/utils/pysvn/Source/pysvn_common.mak
    erp5/trunk/utils/pysvn/Source/setup_configure.py
    erp5/trunk/utils/pysvn/setup.py

Modified: erp5/trunk/utils/pysvn/Source/pysvn_common.mak
URL: http://svn.erp5.org/erp5/trunk/utils/pysvn/Source/pysvn_common.mak?rev=40626&r1=40625&r2=40626&view=diff
==============================================================================
--- erp5/trunk/utils/pysvn/Source/pysvn_common.mak [utf8] (original)
+++ erp5/trunk/utils/pysvn/Source/pysvn_common.mak [utf8] Wed Nov 24 22:23:28 2010
@@ -181,13 +181,13 @@ clean:
 test: pysvn/__init__.py pysvn/%(pysvn_module_name)s
 	PYTHONPATH=. $(PYTHON) -c "import pysvn;print( pysvn );print( pysvn.version );print( pysvn.svn_version );print( pysvn.Client() )"
 
+DISTDIR=$(shell python -c "import os; print os.path.abspath(os.path.join(os.curdir, '..', 'dist'))")
 egg: pysvn/%(pysvn_module_name)s
-	mkdir -p dist
 	mkdir -p dist/EGG-INFO
-	mkdir -p ../dist
+	mkdir -p $(DISTDIR)
 	cp -rvf pysvn dist
 	cp -rvf ../pysvn.egg-info/* dist/EGG-INFO
 	find dist/ | sed 's:dist/::' > dist/EGG-INFO/SOURCES.txt
-	rm -f ../../dist/pysvn-%(pysvn_version)s-py%(python_version)s-%(python_platform)s.egg
-	(cd dist ; zip -r ../../dist/pysvn-%(pysvn_version)s-py%(python_version)s-%(python_platform)s.egg *)
+	rm -f $(DISTDIR)/pysvn-%(pysvn_version)s-py%(python_version)s-%(python_platform)s.egg
+	(cd dist ; zip -r $(DISTDIR)/pysvn-%(pysvn_version)s-py%(python_version)s-%(python_platform)s.egg *)
 	rm -rf dist

Modified: erp5/trunk/utils/pysvn/Source/setup_configure.py
URL: http://svn.erp5.org/erp5/trunk/utils/pysvn/Source/setup_configure.py?rev=40626&r1=40625&r2=40626&view=diff
==============================================================================
--- erp5/trunk/utils/pysvn/Source/setup_configure.py [utf8] (original)
+++ erp5/trunk/utils/pysvn/Source/setup_configure.py [utf8] Wed Nov 24 22:23:28 2010
@@ -27,8 +27,10 @@ class SetupError(Exception):
 
 all_options_info = {
     '--arch':               (2, '<arch>'),
-    '--apr-inc-dir':        (1, '<dir>'),
-    '--apr-lib-dir':        (1, '<dir>'),
+    '--library-dirs':       (1, '<dir>:<dir>:...'),
+    '--include-dirs':       (1, '<dir>:<dir>:...'),
+    '--apr-inc-dir':        (1, '(deprecated) <dir>'),
+    '--apr-lib-dir':        (1, '(deprecated) <dir>'),
     '--define':             (2, '<define-string>'),
     '--enable-debug':       (0, None),
     '--fixed-module-name':  (0, None),
@@ -36,8 +38,8 @@ all_options_info = {
     '--platform':           (1, '<platform-name>'),
     '--pycxx-dir':          (1, '<dir>'),
     '--pycxx-src-dir':      (1, '<dir>'),
-    '--svn-inc-dir':        (1, '<dir>'),
-    '--svn-lib-dir':        (1, '<dir>'),
+    '--svn-inc-dir':        (1, '(deprecated) <dir>'),
+    '--svn-lib-dir':        (1, '(deprecated) <dir>'),
     '--svn-bin-dir':        (1, '<dir>'),
     '--svn-root-dir':       (1, '<dir>'),
     '--verbose':            (0, None),
@@ -300,6 +302,15 @@ class MakeFileCreater:
 
             'lib_apr':          self.lib_apr,    # set as a side effect of find_apr_lib
 
+            # add neon lib dir
+            'neon_lib_dir':   self.find_neon_lib(),
+
+            # add expat lib dir
+            'expat_lib_dir':   self.find_expat_lib(),
+
+            # add ssl lib dir
+            'ssl_lib_dir':   self.find_ssl_lib(),
+
             # pycxx src dir
             'pycxx_dir':        pycxx_dir,
 
@@ -456,6 +467,8 @@ PYCXX=%(pycxx_dir)s
 PYCXXSRC=%(pycxx_src_dir)s
 LDSHARED=g++ -shared %(debug_cflags)s
 LDLIBS=-L%(svn_lib_dir)s -Wl,--rpath -Wl,%(svn_lib_dir)s \
+-L%(neon_lib_dir)s -Wl,--rpath -Wl,%(neon_lib_dir)s \
+-L%(expat_lib_dir)s -Wl,--rpath -Wl,%(expat_lib_dir)s \
 -lsvn_client-1 \
 -lsvn_diff-1 \
 -lsvn_repos-1 \
@@ -478,6 +491,8 @@ PYCXX=%(pycxx_dir)s
 PYCXXSRC=%(pycxx_src_dir)s
 LDSHARED=g++ -shared %(debug_cflags)s
 LDLIBS=-L%(svn_lib_dir)s -Wl,--rpath -Wl,%(svn_lib_dir)s \
+-L%(neon_lib_dir)s -Wl,--rpath -Wl,%(neon_lib_dir)s \
+-L%(expat_lib_dir)s -Wl,--rpath -Wl,%(expat_lib_dir)s \
 -lsvn_client-1 \
 -lsvn_diff-1 \
 -lsvn_repos-1 \
@@ -500,6 +515,9 @@ PYCXX=%(pycxx_dir)s
 PYCXXSRC=%(pycxx_src_dir)s
 LDSHARED=g++ -shared %(debug_cflags)s
 LDLIBS=-L%(svn_lib_dir)s -Wl,--rpath -Wl,%(svn_lib_dir)s \
+-L%(neon_lib_dir)s -Wl,--rpath -Wl,%(neon_lib_dir)s \
+-L%(expat_lib_dir)s -Wl,--rpath -Wl,%(expat_lib_dir)s \
+-L%(ssl_lib_dir)s -Wl,--rpath -Wl,%(ssl_lib_dir)s \
 -lsvn_client-1 \
 -lsvn_diff-1 \
 -lsvn_repos-1 \
@@ -523,6 +541,9 @@ PYCXX=%(pycxx_dir)s
 PYCXXSRC=%(pycxx_src_dir)s
 LDSHARED=g++ -shared %(debug_cflags)s
 LDLIBS=-L%(svn_lib_dir)s \
+-L%(neon_lib_dir)s \
+-L%(expat_lib_dir)s \
+-L%(ssl_lib_dir)s \
 -lsvn_client-1 \
 -lsvn_diff-1 \
 -lsvn_repos-1 \
@@ -546,6 +567,8 @@ PYCXX=%(pycxx_dir)s
 PYCXXSRC=%(pycxx_src_dir)s
 LDSHARED=g++ -shared %(debug_cflags)s
 LDLIBS=-L%(svn_lib_dir)s -Wl,--rpath -Wl,/usr/lib:/usr/local/lib:%(svn_lib_dir)s \
+-L%(neon_lib_dir)s -Wl,--rpath -Wl,/usr/lib:/usr/local/lib:%(neon_lib_dir)s \
+-L%(expat_lib_dir)s -Wl,--rpath -Wl,/usr/lib:/usr/local/lib:%(expat_lib_dir)s \
 -lsvn_client-1 \
 -lsvn_diff-1 \
 -lsvn_repos-1
@@ -610,6 +633,8 @@ PYCXX=%(pycxx_dir)s
 PYCXXSRC=%(pycxx_src_dir)s
 LDSHARED=g++ -shared %(debug_cflags)s
 LDLIBS=-L%(svn_lib_dir)s \
+-L%(neon_lib_dir)s \
+-L%(expat_lib_dir)s \
 -lsvn_client-1   \
 -lsvn_repos-1    \
 -lsvn_subr-1     \
@@ -814,6 +839,7 @@ LDLIBS= \
                     'SVN include',
                     '--svn-inc-dir',
                     'include/subversion-1',
+                    self._include_dirs() +
                     [
                         '/opt/local/include/subversion-1',      # Darwin - darwin ports
                         '/sw/include/subversion-1',             # Darwin - Fink
@@ -842,6 +868,7 @@ LDLIBS= \
                     'SVN library',
                     '--svn-lib-dir',
                     'lib',
+                    self._library_dirs() +
                     [
                         '/opt/local/lib',                       # Darwin - darwin ports
                         '/sw/lib',                              # Darwin - Fink
@@ -865,6 +892,7 @@ LDLIBS= \
                     'APR include',
                     '--apr-inc-dir',
                     'include/%s' % apr_ver,
+                    self._include_dirs() +
                     [
                     ],
                     'apr.h' )
@@ -877,6 +905,7 @@ LDLIBS= \
                     'APR include',
                     '--apr-inc-dir',
                     None,
+                    self._include_dirs() +
                     [
                         '/opt/local/include/%s' % apr_ver,      # Darwin - darwin ports
                         '/sw/include/%s' % apr_ver,             # Darwin - fink
@@ -915,6 +944,7 @@ LDLIBS= \
                     'APR library',
                     '--apr-lib-dir',
                     None,
+                    self._library_dirs() +
                     [
                         '/opt/local/lib',                       # Darwin - darwin ports
                         '/sw/lib',                              # Darwin - fink
@@ -930,6 +960,71 @@ LDLIBS= \
                 last_exception = e
         raise last_exception
 
+    def find_neon_lib( self ):
+        dir = self.find_dir(
+                    'neon library',
+                    None,
+                    None,
+                    self._library_dirs() +
+                    [
+                        '/opt/local/lib',                       # Darwin - darwin ports
+                        '/sw/lib',                              # Darwin - Fink
+                        '/usr/lib64',                           # typical 64bit Linux
+                        '/usr/lib',                             # typical Linux
+                        '/usr/local/lib64',                     # typical 64bit Linux
+                        '/usr/local/lib',                       # typical *BSD
+                        '/usr/pkg/lib',                         # netbsd
+                    ],
+                    self.get_lib_name_for_platform( 'libneon' ) )
+        return dir
+
+    def find_expat_lib( self ):
+        dir = self.find_dir(
+                    'expat library',
+                    None,
+                    None,
+                    self._library_dirs() +
+                    [
+                        '/opt/local/lib',                       # Darwin - darwin ports
+                        '/sw/lib',                              # Darwin - Fink
+                        '/usr/lib64',                           # typical 64bit Linux
+                        '/usr/lib',                             # typical Linux
+                        '/usr/local/lib64',                     # typical 64bit Linux
+                        '/usr/local/lib',                       # typical *BSD
+                        '/usr/pkg/lib',                         # netbsd
+                    ],
+                    self.get_lib_name_for_platform( 'libexpat' ) )
+        return dir
+
+    def find_ssl_lib( self ):
+        dir = self.find_dir(
+                    'ssl library',
+                    None,
+                    None,
+                    self._library_dirs() +
+                    [
+                        '/opt/local/lib',                       # Darwin - darwin ports
+                        '/sw/lib',                              # Darwin - Fink
+                        '/usr/lib64',                           # typical 64bit Linux
+                        '/usr/lib',                             # typical Linux
+                        '/usr/local/lib64',                     # typical 64bit Linux
+                        '/usr/local/lib',                       # typical *BSD
+                        '/usr/pkg/lib',                         # netbsd
+                    ],
+                    self.get_lib_name_for_platform( 'libssl' ) )
+        return dir
+
+    def _library_dirs( self ):
+        if self.hasOption( '--library-dirs' ):
+            return self.getOption( '--library-dirs' ).split(':')
+        else:
+            return []
+
+    def _include_dirs( self ):
+        if self.hasOption( '--include-dirs' ):
+            return self.getOption( '--include-dirs' ).split(':')
+        else:
+            return []
 
     def get_lib_name_for_platform( self, libname ):
         if self.is_mac_os_x:
@@ -948,8 +1043,8 @@ LDLIBS= \
         # override the base_dir_list from the command line kw
         svn_root_dir = None
 
-        if self.hasOption( kw ):
-            base_dir_list = [self.getOption( kw )]
+        if kw and self.hasOption( kw ):
+            base_dir_list = self.getOption( kw ) + base_dir_list
 
         elif( self.hasOption( '--svn-root-dir' )
         and svn_root_suffix is not None ):

Modified: erp5/trunk/utils/pysvn/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/pysvn/setup.py?rev=40626&r1=40625&r2=40626&view=diff
==============================================================================
--- erp5/trunk/utils/pysvn/setup.py [utf8] (original)
+++ erp5/trunk/utils/pysvn/setup.py [utf8] Wed Nov 24 22:23:28 2010
@@ -19,6 +19,7 @@ import sys
 import os
 import os.path
 import setuptools.command.bdist_egg
+from ConfigParser import ConfigParser, NoOptionError, NoSectionError
 
 pysvn_version_info = {}
 f = open( 'Builder/version.info', 'r' )
@@ -27,13 +28,22 @@ for line in f:
     pysvn_version_info[ key ] = value
 
 def run(self):
+    cfg = ConfigParser()
+    cfg.read('setup.cfg')
+    kw = {}
+    for key in ('include-dirs', 'library-dirs'):
+        try:
+            kw[key] = cfg.get('build_ext', key)
+        except (NoOptionError, NoSectionError):
+            kw[key] = ''
+
     # Generate metadata first
     self.run_command("egg_info")
     os.chdir('Source')
-    os.system(sys.executable + ' setup.py configure')
+    os.system(sys.executable + ' setup.py configure --include-dirs=%(include-dirs)s --library-dirs=%(library-dirs)s' % kw)
     os.system('make clean')
     os.system('make')
-    os.system('make egg')
+    os.system('make egg DISTDIR="%s"' % os.path.abspath(os.path.join('..', self.dist_dir)))
     os.chdir('..')              # Go back in parent directory
     # Add to 'Distribution.dist_files' so that the "upload" command works
     getattr( self.distribution, 'dist_files', [] ).append(
@@ -46,7 +56,7 @@ name = "pysvn"
 
 setuptools.setup(
     name = name,
-    version='%(MAJOR)s.%(MINOR)s.%(PATCH)s' % pysvn_version_info,
+    version='%(MAJOR)s.%(MINOR)s.%(PATCH)snxd001' % pysvn_version_info,
     author="Barry Scott",
     author_email="barryscott at tigris.org",
     description="Subversion support for Python",




More information about the Erp5-report mailing list