Alien-SVN
view release on metacpan or search on metacpan
src/subversion/build/generator/gen_win.py view on Meta::CPAN
if min_match:
self.serf_ver_min = int(min_match.group(1))
if patch_match:
self.serf_ver_patch = int(patch_match.group(1))
return self.serf_ver_maj, self.serf_ver_min, self.serf_ver_patch
def _find_serf(self):
"Check if serf and its dependencies are available"
minimal_serf_version = (1, 2, 1)
if self.openssl_path and os.path.exists(self.openssl_path):
version_path = os.path.join(self.openssl_path, 'inc32/openssl/opensslv.h')
if os.path.isfile(version_path):
# We have an OpenSSL Source location (legacy handling)
self.openssl_inc_dir = os.path.join(self.openssl_path, 'inc32')
if self.static_openssl:
self.openssl_lib_dir = os.path.join(self.openssl_path, 'out32')
else:
self.openssl_lib_dir = os.path.join(self.openssl_path, 'out32dll')
elif os.path.isfile(os.path.join(self.openssl_path,
'include/openssl/opensslv.h')):
self.openssl_inc_dir = os.path.join(self.openssl_path, 'include')
self.openssl_lib_dir = os.path.join(self.openssl_path, 'lib')
else:
print('WARNING: \'opensslv.h\' not found')
self.openssl_path = None
self.serf_lib = None
if self.serf_path and os.path.exists(self.serf_path):
if self.openssl_path and os.path.exists(self.openssl_path):
self.serf_lib = 'serf'
version = self._get_serf_version()
if None in version:
msg = 'Unknown serf version found; but, will try to build ' \
'ra_serf.'
else:
self.serf_ver = '.'.join(str(v) for v in version)
if version < minimal_serf_version:
self.serf_lib = None
msg = 'Found serf %s, but >= %s is required. ra_serf will not be built.\n' % \
(self.serf_ver, '.'.join(str(v) for v in minimal_serf_version))
else:
msg = 'Found serf %s' % self.serf_ver
print(msg)
else:
print('openssl not found, ra_serf will not be built\n')
else:
print('serf not found, ra_serf will not be built\n')
def _find_apr(self):
"Find the APR library and version"
minimal_apr_version = (0, 9, 0)
version_file_path = os.path.join(self.apr_path, 'include',
'apr_version.h')
if not os.path.exists(version_file_path):
sys.stderr.write("ERROR: '%s' not found.\n" % version_file_path);
sys.stderr.write("Use '--with-apr' option to configure APR location.\n");
sys.exit(1)
fp = open(version_file_path)
txt = fp.read()
fp.close()
vermatch = re.search(r'^\s*#define\s+APR_MAJOR_VERSION\s+(\d+)', txt, re.M)
major = int(vermatch.group(1))
vermatch = re.search(r'^\s*#define\s+APR_MINOR_VERSION\s+(\d+)', txt, re.M)
minor = int(vermatch.group(1))
vermatch = re.search(r'^\s*#define\s+APR_PATCH_VERSION\s+(\d+)', txt, re.M)
patch = int(vermatch.group(1))
version = (major, minor, patch)
self.apr_version = '%d.%d.%d' % version
suffix = ''
if major > 0:
suffix = '-%d' % major
if self.static_apr:
self.apr_lib = 'apr%s.lib' % suffix
else:
self.apr_lib = 'libapr%s.lib' % suffix
if version < minimal_apr_version:
sys.stderr.write("ERROR: apr %s or higher is required "
"(%s found)\n" % (
'.'.join(str(v) for v in minimal_apr_version),
self.apr_version))
sys.exit(1)
else:
print('Found apr %s' % self.apr_version)
def _find_apr_util(self):
"Find the APR-util library and version"
minimal_aprutil_version = (0, 9, 0)
version_file_path = os.path.join(self.apr_util_path, 'include',
'apu_version.h')
if not os.path.exists(version_file_path):
sys.stderr.write("ERROR: '%s' not found.\n" % version_file_path);
sys.stderr.write("Use '--with-apr-util' option to configure APR-Util location.\n");
sys.exit(1)
fp = open(version_file_path)
txt = fp.read()
fp.close()
vermatch = re.search(r'^\s*#define\s+APU_MAJOR_VERSION\s+(\d+)', txt, re.M)
major = int(vermatch.group(1))
vermatch = re.search(r'^\s*#define\s+APU_MINOR_VERSION\s+(\d+)', txt, re.M)
minor = int(vermatch.group(1))
vermatch = re.search(r'^\s*#define\s+APU_PATCH_VERSION\s+(\d+)', txt, re.M)
patch = int(vermatch.group(1))
version = (major, minor, patch)
self.aprutil_version = '%d.%d.%d' % version
suffix = ''
if major > 0:
suffix = '-%d' % major
if self.static_apr:
self.aprutil_lib = 'aprutil%s.lib' % suffix
else:
self.aprutil_lib = 'libaprutil%s.lib' % suffix
if version < minimal_aprutil_version:
sys.stderr.write("ERROR: aprutil %s or higher is required "
"(%s found)\n" % (
'.'.join(str(v) for v in minimal_aprutil_version),
self.aprutil_version))
sys.exit(1)
else:
print('Found aprutil %s' % self.aprutil_version)
def _find_sqlite(self):
"Find the Sqlite library and version"
minimal_sqlite_version = (3, 7, 12)
header_file = os.path.join(self.sqlite_path, 'inc', 'sqlite3.h')
# First check for compiled version of SQLite.
if os.path.exists(header_file):
# Compiled SQLite seems found, check for sqlite3.lib file.
lib_file = os.path.join(self.sqlite_path, 'lib', 'sqlite3.lib')
if not os.path.exists(lib_file):
sys.stderr.write("ERROR: '%s' not found.\n" % lib_file)
sys.stderr.write("Use '--with-sqlite' option to configure sqlite location.\n");
sys.exit(1)
self.sqlite_inline = False
else:
# Compiled SQLite not found. Try amalgamation version.
amalg_file = os.path.join(self.sqlite_path, 'sqlite3.c')
if not os.path.exists(amalg_file):
sys.stderr.write("ERROR: SQLite not found in '%s' directory.\n" % self.sqlite_path)
sys.stderr.write("Use '--with-sqlite' option to configure sqlite location.\n");
sys.exit(1)
header_file = os.path.join(self.sqlite_path, 'sqlite3.h')
self.sqlite_inline = True
fp = open(header_file)
txt = fp.read()
fp.close()
vermatch = re.search(r'^\s*#define\s+SQLITE_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.(\d))?"', txt, re.M)
version = vermatch.groups()
# Sqlite doesn't add patch numbers for their ordinary releases
if not version[3]:
version = version[0:3]
version = tuple(map(int, version))
self.sqlite_version = '.'.join(str(v) for v in version)
if version < minimal_sqlite_version:
sys.stderr.write("ERROR: sqlite %s or higher is required "
"(%s found)\n" % (
'.'.join(str(v) for v in minimal_sqlite_version),
self.sqlite_version))
sys.exit(1)
else:
print('Found SQLite %s' % self.sqlite_version)
def _find_zlib(self):
"Find the ZLib library and version"
if not self.zlib_path:
self.zlib_version = '1'
return
header_file = os.path.join(self.zlib_path, 'zlib.h')
if not os.path.exists(header_file):
self.zlib_version = '1'
return
fp = open(header_file)
txt = fp.read()
fp.close()
vermatch = re.search(r'^\s*#define\s+ZLIB_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.\d)?"', txt, re.M)
version = tuple(map(int, vermatch.groups()))
self.zlib_version = '%d.%d.%d' % version
print('Found ZLib %s' % self.zlib_version)
class ProjectItem:
"A generic item class for holding sources info, config info, etc for a project"
def __init__(self, **kw):
vars(self).update(kw)
# ============================================================================
# This is a cut-down and modified version of code from:
# subversion/subversion/bindings/swig/python/svn/core.py
#
if sys.platform == "win32":
_escape_shell_arg_re = re.compile(r'(\\+)(\"|$)')
def escape_shell_arg(arg):
# The (very strange) parsing rules used by the C runtime library are
# described at:
# http://msdn.microsoft.com/library/en-us/vclang/html/_pluslang_Parsing_C.2b2b_.Command.2d.Line_Arguments.asp
# double up slashes, but only if they are followed by a quote character
arg = re.sub(_escape_shell_arg_re, r'\1\1\2', arg)
# surround by quotes and escape quotes inside
arg = '"' + arg.replace('"', '"^""') + '"'
return arg
else:
def escape_shell_arg(str):
return "'" + str.replace("'", "'\\''") + "'"
# ============================================================================
( run in 1.240 second using v1.01-cache-2.11-cpan-524268b4103 )