summaryrefslogtreecommitdiffstats
path: root/Mac/scripts/genpluginprojects.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-01-21 22:24:27 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-01-21 22:24:27 (GMT)
commit1eda203a02df15c0b94593b5601f5a2eb2d6ae9d (patch)
tree6819a97f3e6aa50fbed1cb538cffea502fd7df4e /Mac/scripts/genpluginprojects.py
parentd6389956cb2eec713458a7447b121738b53a5244 (diff)
downloadcpython-1eda203a02df15c0b94593b5601f5a2eb2d6ae9d.zip
cpython-1eda203a02df15c0b94593b5601f5a2eb2d6ae9d.tar.gz
cpython-1eda203a02df15c0b94593b5601f5a2eb2d6ae9d.tar.bz2
Added a force option (to force project generation, the default is now to only generate if different).
Try to convert all search paths to relative.
Diffstat (limited to 'Mac/scripts/genpluginprojects.py')
-rw-r--r--Mac/scripts/genpluginprojects.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/Mac/scripts/genpluginprojects.py b/Mac/scripts/genpluginprojects.py
index a22af2b..a785708 100644
--- a/Mac/scripts/genpluginprojects.py
+++ b/Mac/scripts/genpluginprojects.py
@@ -10,22 +10,25 @@ MODULEDIRS = [ # Relative to projectdirs
":::Modules",
]
+# Global variable to control forced rebuild (otherwise the project is only rebuilt
+# when it is changed)
+FORCEREBUILD=0
+
def relpath(base, path):
"""Turn abs path into path relative to another. Only works for 2 abs paths
both pointing to folders"""
if not os.path.isabs(base) or not os.path.isabs(path):
raise 'Absolute paths only'
- if base[-1] != ':':
- base = base +':'
- if path[-1] != ':':
- path = path + ':'
+ if base[-1] == ':':
+ base = base[:-1]
basefields = string.split(base, os.sep)
pathfields = string.split(path, os.sep)
commonfields = len(os.path.commonprefix((basefields, pathfields)))
basefields = basefields[commonfields:]
pathfields = pathfields[commonfields:]
- pathfields = ['']*len(basefields) + pathfields
- return string.join(pathfields, os.sep)
+ pathfields = ['']*(len(basefields)+1) + pathfields
+ rv = string.join(pathfields, os.sep)
+ return rv
def genpluginproject(module,
project=None, projectdir=None,
@@ -45,23 +48,25 @@ def genpluginproject(module,
fn = os.path.join(projectdir, os.path.join(moduledir, sources[0]))
if os.path.exists(fn):
moduledir, sourcefile = os.path.split(fn)
- sourcedirs = [moduledir]
+ sourcedirs = [relpath(projectdir, moduledir)]
sources[0] = sourcefile
break
else:
print "Warning: %s: sourcefile not found: %s"%(module, sources[0])
sourcedirs = []
dict = {
- "sysprefix" : sys.prefix,
+ "sysprefix" : relpath(projectdir, sys.prefix),
"sources" : sources,
"extrasearchdirs" : sourcedirs + extradirs,
"libraries": libraries,
"mac_outputdir" : "::Plugins",
"extraexportsymbols" : extraexportsymbols,
}
- mkcwproject.mkproject(os.path.join(projectdir, project), module, dict)
+ mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD)
-def genallprojects():
+def genallprojects(force=0):
+ global FORCEREBUILD
+ FORCEREBUILD = force
# Standard Python modules
genpluginproject("ucnhash", sources=["ucnhash.c"])
genpluginproject("pyexpat",
@@ -124,3 +129,4 @@ def genallprojects():
if __name__ == '__main__':
genallprojects()
+