Revert "Merge pull request #1145 from AlexandreFoley/wrap-fix"

This reverts commit 541dd92ef7, reversing
changes made to 155617e539.
pull/1199/head
Jussi Pakkanen 9 years ago
parent 21e475b64b
commit b389f43060
  1. 5
      mesonbuild/interpreter.py
  2. 29
      mesonbuild/wrap/wrap.py

@ -1757,9 +1757,8 @@ requirements use the version keyword argument instead.''')
raise
# If the subproject execution failed in a non-fatal way, don't raise an
# exception; let the caller handle things.
except Exception as e:
mlog.warning(e)
mlog.log('Couldn\'t find a fallback subproject in',
except:
mlog.log('Also couldn\'t find a fallback subproject in',
mlog.bold(os.path.join(self.subproject_dir, dirname)),
'for the dependency', mlog.bold(name))
return None

@ -95,16 +95,14 @@ class Resolver:
dirname = os.path.join(self.subdir_root, packagename)
try:
if os.listdir(dirname):
if not os.path.isfile(fname) :
# The directory is there, not empty and there isn't a wrap file?
# Great, use it.
return packagename
# The directory is there and not empty? Great, use it.
return packagename
else:
mlog.warning('Subproject directory %s is empty, removing to'
' ensure clean download' % dirname)
os.rmdir(dirname)
mlog.warning('Subproject directory %s is empty, possibly because of an unfinished'
'checkout, removing to reclone' % dirname)
os.rmdir(checkoutdir)
except NotADirectoryError:
raise RuntimeError('%s is not a directory, can not use as subproject.' %dirname)
raise RuntimeError('%s is not a directory, can not use as subproject.' % dirname)
except FileNotFoundError:
pass
@ -113,11 +111,6 @@ class Resolver:
return None
p = PackageDefinition(fname)
if p.type == 'file':
if os.path.isdir(dirname):
# project already there? great, use it!
# only for the file case because otherwise we prevent git
# and hg from updating the subproject.
return packagename
if not os.path.isdir(self.cachedir):
os.mkdir(self.cachedir)
self.download(p, packagename)
@ -137,11 +130,12 @@ class Resolver:
if is_there:
try:
subprocess.check_call(['git', 'rev-parse'])
is_there = True
except subprocess.CalledProcessError:
raise RuntimeError('%s is not empty but is not a valid '
'git repository, we can not work with it'
' as a subproject directory.'
% (checkoutdir))
' as a subproject directory.' % (
checkoutdir))
if revno.lower() == 'head':
# Failure to do pull is not a fatal error,
@ -169,17 +163,12 @@ class Resolver:
revno = p.get('revision')
is_there = os.path.isdir(checkoutdir)
if is_there:
if not os.path.isdir(os.path.join(checkoutdir, '.hg')):
raise RuntimeError('Subproject %s is not a valid mercurial repo.'%p.get('directory'))
if revno.lower() == 'tip':
# Failure to do pull is not a fatal error,
# because otherwise you can't develop without
# a working net connection.
subprocess.call(['hg', 'pull'], cwd=checkoutdir)
subprocess.call(['hg', 'update', 'tip'],cwd = checkoutdir)
else:
# check that the tag/branch/revision we want is available in the
# repo, if not, pull and update.
if subprocess.call(['hg', 'checkout', revno], cwd=checkoutdir) != 0:
subprocess.check_call(['hg', 'pull'], cwd=checkoutdir)
subprocess.check_call(['hg', 'checkout', revno],

Loading…
Cancel
Save