Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-991

python bindings not working on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • all
    • Beta
    • bindings_swig_python
    • None
    • Windows 2000

    Description

      I was able to create the python bindings on windows by applying the 
      following patch to setup.py.
      I have changed 2 things:
      - adjusted the list of libraries to use for linking
      - added the possibility the specify defines on the command line with -D
      
      Index: setup.py
      ======================================================
      =============
      --- setup.py	(revision 3795)
      +++ setup.py	(working copy)
      @@ -20,6 +20,30 @@
       import sys
       import getopt
       
      +if sys.platform=='win32':
      +  svnclientlib='libsvn_client'
      +  svndeltalib='libsvn_delta'
      +  svnfslib='libsvn_fs'
      +  svnralib='libsvn_ra'
      +  svnreposlib='libsvn_repos'
      +  svnwclib='libsvn_wc'
      +  svnsubrlib='libsvn_subr'
      +  svnswig_pylib='libsvn_swig_py'
      +  platform_libs=['apr','libsvn_wc','libsvn_fs','libsvn_subr',
      +                 'libsvn_delta','libsvn_ra','libsvn_ra_dav',
      +                 'libsvn_ra_local','libsvn_repos','aprutil',
      +                 'advapi32','wsock32','rpcrt4',
      +                 'libdb40']
      +else:
      +  svnclientlib='svn_client-1'
      +  svndeltalib='svn_delta-1'
      +  svnfslib='svn_fs-1'
      +  svnralib='svn_ra-1'
      +  svnreposlib='svn_repos-1'
      +  svnwclib='svn_wc-1'
      +  svnsubrlib='svn_subr-1'
      +  svnswig_pylib='svn_swig_py-1'
      +  platform_libs=['apr-0']
       
       
       def _do_usage():
      @@ -34,12 +58,15 @@
               "search DIR for libraries (multiple instances allowed)"
         print "   -S dir    " + \
               "the DIR for the source of the subversion swig bindings"
      +  print "   -D define    " + \
      +        "extra define to pass to the C compiler"
         print "   -s path   " + \
               "use the swig binary found at PATH"
         sys.exit(0)
       
       # Default option values
       include_dirs = []
      +defines = []
       library_dirs = []
       source_dir = '..'
       swig_location = None
      @@ -54,13 +81,15 @@
       # all the options that we allow (which is FAR less than the set of
       # distutils options).  If we find that people actually care, we can
       # revisit this.
      -options, leftovers = getopt.getopt(sys.argv[1:], "I:L:S:s:h",
      +options, leftovers = getopt.getopt(sys.argv[1:], "I:L:S:s:hD:",
                                          ["prefix=", "install-dir=", "help"])
       for option in options:
         if option[0] == '-I':
           include_dirs.append(option[1])
         if option[0] == '-L':
           library_dirs.append(option[1])
      +  if option[0] == '-D':
      +    defines.append((option[1],None))
         if option[0] == '-S':
           source_dir = option[1]
         if option[0] == '-s':
      @@ -113,6 +142,7 @@
                                   os.path.basename(source[:-2]) + ".c")
             self.announce("swigging %s to %s" % (source, target))
             self.spawn(swig_cmd + ["-o", target, source])
      +      self.announce("swigging %s to %s finished" % (source, target))
             new_sources.append(target)
       
           return new_sources
      @@ -132,41 +162,45 @@
                  ext_modules=[
                    core.Extension("_client",
                                   [source_dir + "/svn_client.i"],
      -                            libraries=['svn_client-1', 'svn_swig_py-1',
      -                                       'swigpy'],
      -                            library_dirs=library_dirs
      +                            libraries=[svnclientlib, svnswig_pylib,'swigpy']
      +platform_libs,
      +                            library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
                    core.Extension("_delta",
                                   [source_dir + "/svn_delta.i"],
      -                            libraries=['svn_delta-1', 'svn_swig_py-1',
      -                                       'swigpy'],
      +                            libraries=[svndeltalib, svnswig_pylib,'swigpy']
      +platform_libs,
                                   library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
                    core.Extension("_fs",
                                   [source_dir + "/svn_fs.i"],
      -                            libraries=['svn_fs-1', 'svn_swig_py-1', 'swigpy'],
      +                            libraries=[svnfslib, svnswig_pylib,'swigpy']
      +platform_libs,
                                   library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
                    core.Extension("_ra",
                                   [source_dir + "/svn_ra.i"],
      -                            libraries=['svn_ra-1', 'swigpy'],
      +                            libraries=[svnralib,'swigpy']+platform_libs,
                                   library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
                    core.Extension("_repos",
                                   [source_dir + "/svn_repos.i"],
      -                            libraries=['svn_repos-1', 'svn_swig_py-1',
      -                                       'swigpy'],
      +                            libraries=[svnreposlib, svnswig_pylib,'swigpy']
      +platform_libs,
                                   library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
                    core.Extension("_wc",
                                   [source_dir + "/svn_wc.i"],
      -                            libraries=['svn_wc-1', 'svn_swig_py-1', 'swigpy'],
      +                            libraries=[svnwclib, svnswig_pylib,'swigpy']
      +platform_libs,
                                   library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
                    core.Extension("_util",
                                   [source_dir + "/util.i"],
      -                            libraries=['svn_subr-1', 'svn_swig_py-
      1', 'swigpy', 'apr-0'],
      +                            libraries=[svnsubrlib, svnswig_pylib,'swigpy']
      +platform_libs,
                                   library_dirs=library_dirs,
      +                            define_macros=defines
                                   ),
       
                    ### will 'auth' be its own, or bundled elsewhere?
      @@ -174,6 +208,7 @@
                    #               ["../svn_auth.i"],
                    #               libraries=['svn_subr-1', 'swigpy', 'apr-0'],
                    #               library_dirs=library_dirs,
      +             #               define_macros=defines
                    #               ),
                    ],
      

      Original issue reported by mahae

      Attachments

        Activity

          People

            Unassigned Unassigned
            subversion-importer Subversion Importer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: