fix scons for Andre's LYX_DATE changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19508 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-08-13 15:46:33 +00:00
parent ded1c011f2
commit 60d63985b7
2 changed files with 54 additions and 47 deletions

View File

@ -60,7 +60,7 @@ if version[0] == 0 and version[1] == 96 and version[2] < 92:
#
# get version number from configure.ac so that JMarc does
# not have to change SConstruct during lyx release
package_version = utils.getVerFromConfigure(top_src_dir)
package_version, lyx_date = utils.getVerFromConfigure(top_src_dir)
package_cygwin_version = '%s-1' % package_version
boost_version = ['1_34']
@ -885,6 +885,41 @@ if sizeof_wchar_t == 0:
print 'Please check config.log for more information.'
Exit(1)
# fill in the version info
env['VERSION_INFO'] = '''Configuration
Host type: %s
Special build flags: %s
C Compiler: %s
C Compiler flags: %s %s
C++ Compiler: %s
C++ Compiler LyX flags: %s
C++ Compiler flags: %s %s
Linker flags: %s
Linker user flags: %s
Build info:
Builing directory: %s
Local library directory: %s
Libraries paths: %s
Boost libraries: %s
include search path: %s
Frontend:
Frontend: %s
Packaging: %s
LyX dir: %s
LyX files dir: %s
''' % (platform_name,
env.subst('$CCFLAGS'), env.subst('$CC'),
env.subst('$CPPFLAGS'), env.subst('$CFLAGS'),
env.subst('$CXX'), env.subst('$CXXFLAGS'),
env.subst('$CPPFLAGS'), env.subst('$CXXFLAGS'),
env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'),
env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'),
str(env['LIBPATH']), str(boost_libraries),
str(env['CPPPATH']),
frontend, packaging_method,
prefix, env['LYX_DIR'])
#
# create config.h
result = utils.createConfigFile(conf,
@ -1035,6 +1070,10 @@ result = utils.createConfigFile(conf,
'Define to the one symbol short name of this package.'),
('#define PACKAGE_VERSION "%s"' % package_version,
'Define to the version of this package.'),
('#define VERSION_INFO "%s"' % env['VERSION_INFO'].replace('\n', '\\n'),
'Full version info'),
('#define LYX_DATE "%s"' % lyx_date,
'Date of release'),
('#define BOOST_ALL_NO_LIB 1',
'disable automatic linking of boost libraries.'),
('#define USE_%s_PACKAGING 1' % packaging_method.upper(),
@ -1394,47 +1433,7 @@ if frontend == 'qt4':
#
# Report results
#
# fill in the version info
env['VERSION_INFO'] = '''Configuration
Host type: %s
Special build flags: %s
C Compiler: %s
C Compiler flags: %s %s
C++ Compiler: %s
C++ Compiler LyX flags: %s
C++ Compiler flags: %s %s
Linker flags: %s
Linker user flags: %s
Build info:
Builing directory: %s
Local library directory: %s
Libraries paths: %s
Boost libraries: %s
Frontend libraries: %s
System libraries: %s
include search path: %s
Frontend:
Frontend: %s
Packaging: %s
LyX dir: %s
LyX files dir: %s
''' % (platform_name,
env.subst('$CCFLAGS'), env.subst('$CC'),
env.subst('$CPPFLAGS'), env.subst('$CFLAGS'),
env.subst('$CXX'), env.subst('$CXXFLAGS'),
env.subst('$CPPFLAGS'), env.subst('$CXXFLAGS'),
env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'),
env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'),
str(env['LIBPATH']), str(boost_libraries),
str(frontend_libs), str(system_libs), str(env['CPPPATH']),
frontend, packaging_method,
prefix, env['LYX_DIR'])
if frontend in ['qt4']:
env['VERSION_INFO'] += ''' include dir: %s
library dir: %s
X11: %s
''' % (qt_inc_path, qt_lib_path, env['X11'])
print env['VERSION_INFO']

View File

@ -17,7 +17,9 @@ from SCons.Util import *
def getVerFromConfigure(path):
" get lyx version from the AC_INIT line of configure.ac "
''' get lyx version from the AC_INIT line of configure.ac,
and LYX_DATE from an AC_SUBST line.
'''
try:
config = open(os.path.join(path, 'configure.ac'))
except:
@ -25,12 +27,18 @@ def getVerFromConfigure(path):
return 'x.x.x'
# find a line like follows
# AC_INIT(LyX,1.4.4svn,[lyx-devel@lists.lyx.org],[lyx])
pat = re.compile('AC_INIT\([^,]+,([^,]+),')
ver_pat = re.compile('AC_INIT\([^,]+,([^,]+),')
date_pat = re.compile('AC_SUBST\(LYX_DATE, \["(.*)"\]\)')
version = 'x.x.x'
date = 'Not released'
for line in config.readlines():
if pat.match(line):
(version,) = pat.match(line).groups()
return version.strip()
return 'x.x.x'
if ver_pat.match(line):
(version,) = ver_pat.match(line).groups()
if date_pat.match(line):
(date,) = date_pat.match(line).groups()
if version != 'x.x.x' and date != 'Not released':
break
return version.strip(), date.strip()
def relativePath(path, base):