mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Use relative path for outputdir.
This commit is contained in:
parent
b55e5f1b62
commit
b55b7bb3ab
1 changed files with 19 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import mkcwproject
|
import mkcwproject
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import string
|
||||||
|
|
||||||
PROJECTDIR = os.path.join(sys.prefix, ":Mac:Build")
|
PROJECTDIR = os.path.join(sys.prefix, ":Mac:Build")
|
||||||
MODULEDIRS = [ # Relative to projectdirs
|
MODULEDIRS = [ # Relative to projectdirs
|
||||||
|
@ -9,6 +10,23 @@ MODULEDIRS = [ # Relative to projectdirs
|
||||||
":::Modules",
|
":::Modules",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
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 + ':'
|
||||||
|
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)
|
||||||
|
|
||||||
def genpluginproject(module,
|
def genpluginproject(module,
|
||||||
project=None, projectdir=None,
|
project=None, projectdir=None,
|
||||||
sources=[], sourcedirs=[],
|
sources=[], sourcedirs=[],
|
||||||
|
@ -38,7 +56,7 @@ def genpluginproject(module,
|
||||||
"sources" : sources,
|
"sources" : sources,
|
||||||
"extrasearchdirs" : sourcedirs + extradirs,
|
"extrasearchdirs" : sourcedirs + extradirs,
|
||||||
"libraries": libraries,
|
"libraries": libraries,
|
||||||
"mac_outputdir" : os.path.join(sys.prefix, ":Mac:Plugins"),
|
"mac_outputdir" : "::Plugins",
|
||||||
"extraexportsymbols" : extraexportsymbols,
|
"extraexportsymbols" : extraexportsymbols,
|
||||||
}
|
}
|
||||||
mkcwproject.mkproject(os.path.join(projectdir, project), module, dict)
|
mkcwproject.mkproject(os.path.join(projectdir, project), module, dict)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue