2019-07-21 13:26:02 +00:00
|
|
|
#!/usr/bin/env python3
|
2013-08-28 00:44:27 +00:00
|
|
|
# LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org
|
|
|
|
# Released to the public domain.
|
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
# Update Scintilla files.
|
|
|
|
# Update version numbers and modification dates in documentation and header files.
|
|
|
|
# Update make dependencies.
|
2019-07-21 13:26:02 +00:00
|
|
|
# Requires Python 3.6 or later
|
2013-08-28 00:44:27 +00:00
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
from FileGenerator import UpdateLineInFile, ReplaceREInFile, UpdateLineInPlistFile
|
2013-08-28 00:44:27 +00:00
|
|
|
import ScintillaData
|
2015-06-07 21:19:26 +00:00
|
|
|
import HFacer
|
2019-07-21 13:26:02 +00:00
|
|
|
import os
|
2021-02-21 04:53:09 +00:00
|
|
|
import pathlib
|
2019-07-21 13:26:02 +00:00
|
|
|
import sys
|
|
|
|
|
|
|
|
baseDirectory = os.path.dirname(os.path.dirname(ScintillaData.__file__))
|
|
|
|
sys.path.append(baseDirectory)
|
|
|
|
|
|
|
|
import win32.DepGen
|
|
|
|
import gtk.DepGen
|
2013-08-28 00:44:27 +00:00
|
|
|
|
|
|
|
def UpdateVersionNumbers(sci, root):
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "win32/ScintRes.rc", "#define VERSION_SCINTILLA",
|
2013-08-28 00:44:27 +00:00
|
|
|
"#define VERSION_SCINTILLA \"" + sci.versionDotted + "\"")
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "win32/ScintRes.rc", "#define VERSION_WORDS",
|
2013-08-28 00:44:27 +00:00
|
|
|
"#define VERSION_WORDS " + sci.versionCommad)
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "qt/ScintillaEditBase/ScintillaEditBase.pro",
|
2013-08-28 00:44:27 +00:00
|
|
|
"VERSION =",
|
|
|
|
"VERSION = " + sci.versionDotted)
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "qt/ScintillaEdit/ScintillaEdit.pro",
|
2013-08-28 00:44:27 +00:00
|
|
|
"VERSION =",
|
|
|
|
"VERSION = " + sci.versionDotted)
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "doc/ScintillaDownload.html", " Release",
|
2013-08-28 00:44:27 +00:00
|
|
|
" Release " + sci.versionDotted)
|
2021-02-21 04:53:09 +00:00
|
|
|
ReplaceREInFile(root / "doc/ScintillaDownload.html",
|
2019-05-04 18:14:48 +00:00
|
|
|
r"/www.scintilla.org/([a-zA-Z]+)\d\d\d",
|
2022-01-04 23:07:50 +00:00
|
|
|
r"/www.scintilla.org/\g<1>" + sci.version,
|
|
|
|
0)
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "doc/index.html",
|
2013-08-28 00:44:27 +00:00
|
|
|
' <font color="#FFCC99" size="3"> Release version',
|
|
|
|
' <font color="#FFCC99" size="3"> Release version ' +\
|
|
|
|
sci.versionDotted + '<br />')
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "doc/index.html",
|
2013-08-28 00:44:27 +00:00
|
|
|
' Site last modified',
|
|
|
|
' Site last modified ' + sci.mdyModified + '</font>')
|
2021-02-21 04:53:09 +00:00
|
|
|
UpdateLineInFile(root / "doc/ScintillaHistory.html",
|
2013-08-28 00:44:27 +00:00
|
|
|
' Released ',
|
|
|
|
' Released ' + sci.dmyModified + '.')
|
2021-02-21 04:53:09 +00:00
|
|
|
|
|
|
|
cocoa = root / "cocoa"
|
|
|
|
|
|
|
|
UpdateLineInPlistFile(cocoa / "Scintilla" / "Info.plist",
|
2019-05-04 18:14:48 +00:00
|
|
|
"CFBundleShortVersionString", sci.versionDotted)
|
2021-02-21 04:53:09 +00:00
|
|
|
ReplaceREInFile(cocoa / "Scintilla"/ "Scintilla.xcodeproj" / "project.pbxproj",
|
|
|
|
"CURRENT_PROJECT_VERSION = [0-9.]+;",
|
2022-01-04 23:07:50 +00:00
|
|
|
f'CURRENT_PROJECT_VERSION = {sci.versionDotted};',
|
|
|
|
0)
|
2013-08-28 00:44:27 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
def RegenerateAll(rootDirectory):
|
2022-01-04 23:07:50 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
root = pathlib.Path(rootDirectory)
|
2019-05-04 18:14:48 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
scintillaBase = root.resolve()
|
2019-07-21 13:26:02 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
sci = ScintillaData.ScintillaData(scintillaBase)
|
2013-08-28 00:44:27 +00:00
|
|
|
|
2019-07-21 13:26:02 +00:00
|
|
|
startDir = os.getcwd()
|
|
|
|
os.chdir(os.path.join(scintillaBase, "win32"))
|
|
|
|
win32.DepGen.Generate()
|
|
|
|
os.chdir(os.path.join(scintillaBase, "gtk"))
|
|
|
|
gtk.DepGen.Generate()
|
|
|
|
os.chdir(startDir)
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
UpdateVersionNumbers(sci, root)
|
2019-05-04 18:14:48 +00:00
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
HFacer.RegenerateAll(root, False)
|
2013-08-28 00:44:27 +00:00
|
|
|
|
|
|
|
if __name__=="__main__":
|
2021-02-21 04:53:09 +00:00
|
|
|
RegenerateAll(pathlib.Path(__file__).resolve().parent.parent)
|