From d04015772a80af227ae05d47c112933e152aec48 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 8 Apr 2019 16:31:00 +1000 Subject: Make dependencies scripts work when called from scite/scripts/RegenerateSource.py. --- gtk/DepGen.py | 4 ++-- scripts/Dependencies.py | 5 ++++- scripts/LexGen.py | 10 +++++++++- win32/DepGen.py | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gtk/DepGen.py b/gtk/DepGen.py index 20f4a0148..4feea8a9c 100644 --- a/gtk/DepGen.py +++ b/gtk/DepGen.py @@ -6,9 +6,9 @@ import sys -sys.path.append("../") +sys.path.append("..") -import scripts.Dependencies as Dependencies +from scripts import Dependencies topComment = "# Created by DepGen.py. To recreate, run 'python DepGen.py'.\n" diff --git a/scripts/Dependencies.py b/scripts/Dependencies.py index 86a2d3b22..a30295a58 100644 --- a/scripts/Dependencies.py +++ b/scripts/Dependencies.py @@ -21,7 +21,10 @@ import codecs, glob, os, sys -from . import FileGenerator +if __name__ == "__main__": + import FileGenerator +else: + from . import FileGenerator continuationLineEnd = " \\" diff --git a/scripts/LexGen.py b/scripts/LexGen.py index 82eb39182..6e11c529b 100644 --- a/scripts/LexGen.py +++ b/scripts/LexGen.py @@ -13,10 +13,12 @@ from FileGenerator import Regenerate, UpdateLineInFile, \ FindSectionInList import ScintillaData import HFacer +import os import uuid import sys -sys.path.append("../") +baseDirectory = os.path.dirname(os.path.dirname(ScintillaData.__file__)) +sys.path.append(baseDirectory) import win32.DepGen import gtk.DepGen @@ -116,13 +118,19 @@ def RegenerateXcodeProject(path, lexers, lexerReferences): def RegenerateAll(root): + scintillaBase = os.path.abspath(root) + sci = ScintillaData.ScintillaData(root) Regenerate(root + "src/Catalogue.cxx", "//", sci.lexerModules) Regenerate(root + "win32/scintilla.mak", "#", sci.lexFiles) + 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) RegenerateXcodeProject(root + "cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj", sci.lexFiles, sci.lexersXcode) diff --git a/win32/DepGen.py b/win32/DepGen.py index c43d2f66c..3abf68936 100644 --- a/win32/DepGen.py +++ b/win32/DepGen.py @@ -6,9 +6,9 @@ import sys -sys.path.append("../") +sys.path.append("..") -import scripts.Dependencies as Dependencies +from scripts import Dependencies topComment = "# Created by DepGen.py. To recreate, run 'python DepGen.py'.\n" -- cgit v1.2.3