mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 841713 - Add objdir paths to virtualenv; r=ted
This commit is contained in:
parent
a8cc664d4e
commit
007c5b7899
@ -53,7 +53,7 @@ if test -z $DONT_POPULATE_VIRTUALENV; then
|
|||||||
dnl virtualenv is present and up to date. It sanitizes the environment
|
dnl virtualenv is present and up to date. It sanitizes the environment
|
||||||
dnl for us, so we don't need to clean anything out.
|
dnl for us, so we don't need to clean anything out.
|
||||||
$PYTHON $_virtualenv_populate_path \
|
$PYTHON $_virtualenv_populate_path \
|
||||||
$_virtualenv_topsrcdir $MOZ_BUILD_ROOT/_virtualenv || exit 1
|
$_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
mingw*)
|
mingw*)
|
||||||
|
@ -13,3 +13,4 @@ mozilla.pth:config
|
|||||||
mozilla.pth:xpcom/typelib/xpt/tools
|
mozilla.pth:xpcom/typelib/xpt/tools
|
||||||
copy:build/buildconfig.py
|
copy:build/buildconfig.py
|
||||||
packages.txt:testing/mozbase/packages.txt
|
packages.txt:testing/mozbase/packages.txt
|
||||||
|
objdir:build
|
||||||
|
@ -22,7 +22,8 @@ MINIMUM_PYTHON_MINOR = 7
|
|||||||
class VirtualenvManager(object):
|
class VirtualenvManager(object):
|
||||||
"""Contains logic for managing virtualenvs for building the tree."""
|
"""Contains logic for managing virtualenvs for building the tree."""
|
||||||
|
|
||||||
def __init__(self, topsrcdir, virtualenv_path, log_handle, manifest_path):
|
def __init__(self, topsrcdir, topobjdir, virtualenv_path, log_handle,
|
||||||
|
manifest_path):
|
||||||
"""Create a new manager.
|
"""Create a new manager.
|
||||||
|
|
||||||
Each manager is associated with a source directory, a path where you
|
Each manager is associated with a source directory, a path where you
|
||||||
@ -30,6 +31,7 @@ class VirtualenvManager(object):
|
|||||||
"""
|
"""
|
||||||
assert os.path.isabs(manifest_path), "manifest_path must be an absolute path: %s" % (manifest_path)
|
assert os.path.isabs(manifest_path), "manifest_path must be an absolute path: %s" % (manifest_path)
|
||||||
self.topsrcdir = topsrcdir
|
self.topsrcdir = topsrcdir
|
||||||
|
self.topobjdir = topobjdir
|
||||||
self.virtualenv_root = virtualenv_path
|
self.virtualenv_root = virtualenv_path
|
||||||
self.log_handle = log_handle
|
self.log_handle = log_handle
|
||||||
self.manifest_path = manifest_path
|
self.manifest_path = manifest_path
|
||||||
@ -151,6 +153,14 @@ class VirtualenvManager(object):
|
|||||||
copy -- Copies the given file in the virtualenv site packages
|
copy -- Copies the given file in the virtualenv site packages
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
packages.txt -- Denotes that the specified path is a child manifest. It
|
||||||
|
will be read and processed as if its contents were concatenated
|
||||||
|
into the manifest being read.
|
||||||
|
|
||||||
|
objdir -- Denotes a relative path in the object directory to add to the
|
||||||
|
search path. e.g. "objdir:build" will add $topobjdir/build to the
|
||||||
|
search path.
|
||||||
|
|
||||||
Note that the Python interpreter running this function should be the
|
Note that the Python interpreter running this function should be the
|
||||||
one from the virtualenv. If it is the system Python or if the
|
one from the virtualenv. If it is the system Python or if the
|
||||||
environment is not configured properly, packages could be installed
|
environment is not configured properly, packages could be installed
|
||||||
@ -185,6 +195,7 @@ class VirtualenvManager(object):
|
|||||||
src = os.path.join(self.topsrcdir, package[1])
|
src = os.path.join(self.topsrcdir, package[1])
|
||||||
assert os.path.isfile(src), "'%s' does not exist" % src
|
assert os.path.isfile(src), "'%s' does not exist" % src
|
||||||
submanager = VirtualenvManager(self.topsrcdir,
|
submanager = VirtualenvManager(self.topsrcdir,
|
||||||
|
self.topobjdir,
|
||||||
self.virtualenv_root,
|
self.virtualenv_root,
|
||||||
self.log_handle,
|
self.log_handle,
|
||||||
src)
|
src)
|
||||||
@ -212,6 +223,15 @@ class VirtualenvManager(object):
|
|||||||
file=self.log_handle)
|
file=self.log_handle)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if package[0] == 'objdir':
|
||||||
|
assert len(package) == 2
|
||||||
|
path = os.path.join(self.topobjdir, package[1])
|
||||||
|
|
||||||
|
with open(os.path.join(python_lib, 'objdir.pth'), 'a') as f:
|
||||||
|
f.write('%s\n' % path)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
raise Exception('Unknown action: %s' % package[0])
|
raise Exception('Unknown action: %s' % package[0])
|
||||||
|
|
||||||
# We always target the OS X deployment target that Python itself was
|
# We always target the OS X deployment target that Python itself was
|
||||||
@ -293,7 +313,7 @@ class VirtualenvManager(object):
|
|||||||
# the virtualenv for paths to be proper.
|
# the virtualenv for paths to be proper.
|
||||||
|
|
||||||
args = [self.python_path, __file__, 'populate', self.topsrcdir,
|
args = [self.python_path, __file__, 'populate', self.topsrcdir,
|
||||||
self.virtualenv_root]
|
self.topobjdir, self.virtualenv_root]
|
||||||
|
|
||||||
result = subprocess.call(args, stdout=self.log_handle,
|
result = subprocess.call(args, stdout=self.log_handle,
|
||||||
stderr=subprocess.STDOUT, cwd=self.topsrcdir)
|
stderr=subprocess.STDOUT, cwd=self.topsrcdir)
|
||||||
@ -329,26 +349,29 @@ def verify_python_version(log_handle):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 4:
|
||||||
print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/virtualenv')
|
print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/topobjdir /path/to/virtualenv')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
verify_python_version(sys.stdout)
|
verify_python_version(sys.stdout)
|
||||||
|
|
||||||
topsrcdir = sys.argv[1]
|
topsrcdir = sys.argv[1]
|
||||||
virtualenv_path = sys.argv[2]
|
topobjdir = sys.argv[2]
|
||||||
|
virtualenv_path = sys.argv[3]
|
||||||
populate = False
|
populate = False
|
||||||
|
|
||||||
# This should only be called internally.
|
# This should only be called internally.
|
||||||
if sys.argv[1] == 'populate':
|
if sys.argv[1] == 'populate':
|
||||||
populate = True
|
populate = True
|
||||||
topsrcdir = sys.argv[2]
|
topsrcdir = sys.argv[2]
|
||||||
virtualenv_path = sys.argv[3]
|
topobjdir = sys.argv[3]
|
||||||
|
virtualenv_path = sys.argv[4]
|
||||||
|
|
||||||
# path to default packages.txt
|
# path to default packages.txt
|
||||||
manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
|
manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
|
||||||
|
|
||||||
manager = VirtualenvManager(topsrcdir, virtualenv_path, sys.stdout, manifest_path)
|
manager = VirtualenvManager(topsrcdir, topobjdir, virtualenv_path,
|
||||||
|
sys.stdout, manifest_path)
|
||||||
|
|
||||||
if populate:
|
if populate:
|
||||||
manager.populate()
|
manager.populate()
|
||||||
|
@ -53,7 +53,7 @@ if test -z $DONT_POPULATE_VIRTUALENV; then
|
|||||||
dnl virtualenv is present and up to date. It sanitizes the environment
|
dnl virtualenv is present and up to date. It sanitizes the environment
|
||||||
dnl for us, so we don't need to clean anything out.
|
dnl for us, so we don't need to clean anything out.
|
||||||
$PYTHON $_virtualenv_populate_path \
|
$PYTHON $_virtualenv_populate_path \
|
||||||
$_virtualenv_topsrcdir $MOZ_BUILD_ROOT/_virtualenv || exit 1
|
$_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
mingw*)
|
mingw*)
|
||||||
|
Loading…
Reference in New Issue
Block a user