~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to build/generator/swig/external_runtime.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
# external_runtime.py: Generate external runtime files for SWIG
25
25
#
26
26
 
27
 
import sys, os, re, fileinput
 
27
import sys
 
28
import os
 
29
import re
 
30
import fileinput
 
31
import filecmp
 
32
 
28
33
if __name__ == "__main__":
29
34
  parent_dir = os.path.dirname(os.path.abspath(os.path.dirname(sys.argv[0])))
30
35
  sys.path[0:0] = [ parent_dir, os.path.dirname(parent_dir) ]
63
68
      "python": "pyrun.swg", "perl":"perlrun.swg", "ruby":"rubydef.swg"
64
69
    }
65
70
 
66
 
    # Build runtime files
67
 
    out = self._output_file(lang)
 
71
    # Build runtime files to temporary location
 
72
    dest = self._output_file(lang)
 
73
    out = dest + '.tmp'
 
74
 
68
75
    if self.version() == (1, 3, 24):
69
76
      out_file = open(out, "w")
70
77
      out_file.write(open("%s/swigrun.swg" % self.proxy_dir).read())
99
106
        sys.stdout.write(
100
107
          re.sub(r"SWIG_GetModule\(\)", "SWIG_GetModule(NULL)", line)
101
108
        )
 
109
 
 
110
    # Did the output change?
 
111
    try:
 
112
      if filecmp.cmp(dest, out):
 
113
        identical = True
 
114
      else:
 
115
        identical = False
 
116
    except:
 
117
      identical = False
 
118
 
 
119
    # Only overwrite file if changed
 
120
    if identical:
 
121
      os.remove(out)
 
122
    else:
 
123
      try:
 
124
        os.remove(dest)
 
125
      except: pass
 
126
      os.rename(out, dest)
 
127
      print('Wrote %s' % (dest,))
 
128
 
102
129
  def _output_file(self, lang):
103
130
    """Return the output filename of the runtime for the given language"""
104
131
    return '%s/swig_%s_external_runtime.swg' % (self.proxy_dir, lang)