mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout changeset c779b2ab7695 (bug 830996) for breaking standalone SpiderMonkey builds
--HG-- extra : rebase_source : c4ad0b666c2043d248fe58d72837f678b260e0b0
This commit is contained in:
parent
112057edfd
commit
70ec8ee906
@ -1,4 +1,15 @@
|
||||
simplejson.pth:python/simplejson-2.1.1
|
||||
manifestdestiny.pth:testing/mozbase/manifestdestiny
|
||||
mozcrash.pth:testing/mozbase/mozcrash
|
||||
mozdevice.pth:testing/mozbase/mozdevice
|
||||
mozfile.pth:testing/mozbase/mozfile
|
||||
mozhttpd.pth:testing/mozbase/mozhttpd
|
||||
mozinfo.pth:testing/mozbase/mozinfo
|
||||
mozinstall.pth:testing/mozbase/mozinstall
|
||||
mozlog.pth:testing/mozbase/mozlog
|
||||
mozprocess.pth:testing/mozbase/mozprocess
|
||||
mozprofile.pth:testing/mozbase/mozprofile
|
||||
mozrunner.pth:testing/mozbase/mozrunner
|
||||
marionette.pth:testing/marionette/client
|
||||
blessings.pth:python/blessings
|
||||
mach.pth:python/mach
|
||||
@ -12,4 +23,3 @@ mozilla.pth:build
|
||||
mozilla.pth:config
|
||||
mozilla.pth:xpcom/typelib/xpt/tools
|
||||
copy:build/buildconfig.py
|
||||
packages.txt:testing/mozbase/packages.txt
|
||||
|
@ -22,7 +22,7 @@ MINIMUM_PYTHON_MINOR = 7
|
||||
class VirtualenvManager(object):
|
||||
"""Contains logic for managing virtualenvs for building the tree."""
|
||||
|
||||
def __init__(self, topsrcdir, virtualenv_path, log_handle, manifest_path):
|
||||
def __init__(self, topsrcdir, virtualenv_path, log_handle):
|
||||
"""Create a new manager.
|
||||
|
||||
Each manager is associated with a source directory, a path where you
|
||||
@ -31,7 +31,6 @@ class VirtualenvManager(object):
|
||||
self.topsrcdir = topsrcdir
|
||||
self.virtualenv_root = virtualenv_path
|
||||
self.log_handle = log_handle
|
||||
self.manifest_path = manifest_path
|
||||
|
||||
@property
|
||||
def virtualenv_script_path(self):
|
||||
@ -39,6 +38,11 @@ class VirtualenvManager(object):
|
||||
return os.path.join(self.topsrcdir, 'python', 'virtualenv',
|
||||
'virtualenv.py')
|
||||
|
||||
@property
|
||||
def manifest_path(self):
|
||||
return os.path.join(self.topsrcdir, 'build', 'virtualenv',
|
||||
'packages.txt')
|
||||
|
||||
@property
|
||||
def python_path(self):
|
||||
if sys.platform in ('win32', 'cygwin'):
|
||||
@ -54,36 +58,6 @@ class VirtualenvManager(object):
|
||||
|
||||
return os.path.join(self.virtualenv_root, 'bin', 'activate_this.py')
|
||||
|
||||
def up_to_date(self):
|
||||
"""Returns whether the virtualenv is present and up to date."""
|
||||
|
||||
deps = [self.manifest_path, __file__]
|
||||
|
||||
# check if virtualenv exists
|
||||
if not os.path.exists(self.virtualenv_root) or \
|
||||
not os.path.exists(self.activate_path):
|
||||
|
||||
return False
|
||||
|
||||
# check modification times
|
||||
activate_mtime = os.path.getmtime(self.activate_path)
|
||||
dep_mtime = max(os.path.getmtime(p) for p in deps)
|
||||
if dep_mtime > activate_mtime:
|
||||
return False
|
||||
|
||||
# recursively check sub packages.txt files
|
||||
submanifests = [i for i in self.packages()
|
||||
if i[0] == 'packages.txt']
|
||||
for submanifest in submanifests:
|
||||
submanager = VirtualenvManager(self.topsrcdir,
|
||||
self.virtualenv_root,
|
||||
self.log_handle,
|
||||
src)
|
||||
if not submanager.up_to_date():
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def ensure(self):
|
||||
"""Ensure the virtualenv is present and up to date.
|
||||
|
||||
@ -93,9 +67,20 @@ class VirtualenvManager(object):
|
||||
This should be the main API used from this class as it is the
|
||||
highest-level.
|
||||
"""
|
||||
if self.up_to_date():
|
||||
return self.virtualenv_root
|
||||
return self.build()
|
||||
deps = [self.manifest_path, __file__]
|
||||
|
||||
if not os.path.exists(self.virtualenv_root) or \
|
||||
not os.path.exists(self.activate_path):
|
||||
|
||||
return self.build()
|
||||
|
||||
activate_mtime = os.path.getmtime(self.activate_path)
|
||||
dep_mtime = max(os.path.getmtime(p) for p in deps)
|
||||
|
||||
if dep_mtime > activate_mtime:
|
||||
return self.build()
|
||||
|
||||
return self.virtualenv_root
|
||||
|
||||
def create(self):
|
||||
"""Create a new, empty virtualenv.
|
||||
@ -105,7 +90,10 @@ class VirtualenvManager(object):
|
||||
write output to.
|
||||
"""
|
||||
env = dict(os.environ)
|
||||
env.pop('PYTHONDONTWRITEBYTECODE', None)
|
||||
try:
|
||||
del env['PYTHONDONTWRITEBYTECODE']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
args = [sys.executable, self.virtualenv_script_path,
|
||||
'--system-site-packages', self.virtualenv_root]
|
||||
@ -113,17 +101,11 @@ class VirtualenvManager(object):
|
||||
result = subprocess.call(args, stdout=self.log_handle,
|
||||
stderr=subprocess.STDOUT, env=env)
|
||||
|
||||
if result:
|
||||
if result != 0:
|
||||
raise Exception('Error creating virtualenv.')
|
||||
|
||||
return self.virtualenv_root
|
||||
|
||||
def packages(self):
|
||||
with file(self.manifest_path, 'rU') as fh:
|
||||
packages = [line.rstrip().split(':')
|
||||
for line in fh]
|
||||
return packages
|
||||
|
||||
def populate(self):
|
||||
"""Populate the virtualenv.
|
||||
|
||||
@ -154,8 +136,11 @@ class VirtualenvManager(object):
|
||||
environment is not configured properly, packages could be installed
|
||||
into the wrong place. This is how virtualenv's work.
|
||||
"""
|
||||
|
||||
packages = self.packages()
|
||||
packages = []
|
||||
fh = open(self.manifest_path, 'rU')
|
||||
for line in fh:
|
||||
packages.append(line.rstrip().split(':'))
|
||||
fh.close()
|
||||
|
||||
def handle_package(package):
|
||||
python_lib = distutils.sysconfig.get_python_lib()
|
||||
@ -177,19 +162,6 @@ class VirtualenvManager(object):
|
||||
|
||||
return True
|
||||
|
||||
if package[0] == 'packages.txt':
|
||||
assert len(package) == 2
|
||||
|
||||
src = os.path.join(self.topsrcdir, package[1])
|
||||
assert os.path.isfile(src), "'%s' does not exist" % src
|
||||
submanager = VirtualenvManager(self.topsrcdir,
|
||||
self.virtualenv_root,
|
||||
self.log_handle,
|
||||
src)
|
||||
submanager.populate()
|
||||
|
||||
return True
|
||||
|
||||
if package[0].endswith('.pth'):
|
||||
assert len(package) == 2
|
||||
|
||||
@ -249,12 +221,17 @@ class VirtualenvManager(object):
|
||||
for package in packages:
|
||||
handle_package(package)
|
||||
finally:
|
||||
os.environ.pop('MACOSX_DEPLOYMENT_TARGET', None)
|
||||
try:
|
||||
del os.environ['MACOSX_DEPLOYMENT_TARGET']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if old_target is not None:
|
||||
os.environ['MACOSX_DEPLOYMENT_TARGET'] = old_target
|
||||
|
||||
os.environ.update(old_env_variables)
|
||||
for k in old_env_variables:
|
||||
os.environ[k] = old_env_variables[k]
|
||||
|
||||
|
||||
def call_setup(self, directory, arguments):
|
||||
"""Calls setup.py in a directory."""
|
||||
@ -343,10 +320,7 @@ if __name__ == '__main__':
|
||||
topsrcdir = sys.argv[2]
|
||||
virtualenv_path = sys.argv[3]
|
||||
|
||||
# path to default packages.txt
|
||||
manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
|
||||
|
||||
manager = VirtualenvManager(topsrcdir, virtualenv_path, sys.stdout, manifest_path)
|
||||
manager = VirtualenvManager(topsrcdir, virtualenv_path, sys.stdout)
|
||||
|
||||
if populate:
|
||||
manager.populate()
|
||||
|
Loading…
Reference in New Issue
Block a user