aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2018-01-29 19:02:35 +0200
committerMatti Picus <matti.picus@gmail.com>2018-01-29 19:02:35 +0200
commit3f9300731e2e074fcb6033d1b8404d4b186138d9 (patch)
tree9dc3002ae6d65035dd8179d05b118ff6af78c1a7 /get_externals.py
parentdocument vc v14, still not clear how to handle extern libraries and _ssl (diff)
downloadpypy-3f9300731e2e074fcb6033d1b8404d4b186138d9.tar.gz
pypy-3f9300731e2e074fcb6033d1b8404d4b186138d9.tar.bz2
pypy-3f9300731e2e074fcb6033d1b8404d4b186138d9.zip
add externals and vsver to MSvcPlatform, add external build dependencies repo
Diffstat (limited to 'get_externals.py')
-rw-r--r--get_externals.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/get_externals.py b/get_externals.py
new file mode 100644
index 0000000000..70d1304170
--- /dev/null
+++ b/get_externals.py
@@ -0,0 +1,66 @@
+'''Get external dependencies for building PyPy
+they will end up in the platform.host().basepath, something like repo-root/external
+'''
+
+from __future__ import print_function
+
+import argparse
+import os
+import zipfile
+from subprocess import Popen, PIPE
+from rpython.translator.platform import host
+
+def runcmd(cmd, verbose):
+ stdout = stderr = ''
+ report = False
+ try:
+ p = Popen(cmd, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p.communicate()
+ if p.wait() != 0 or verbose:
+ report = True
+ except Exception as e:
+ stderr = str(e) + '\n' + stderr
+ report = True
+ if report:
+ print('running "%s" returned\n%s\n%s' % (cmd, stdout, stderr))
+ if stderr:
+ raise RuntimeError(stderr)
+
+def checkout_repo(dest='externals', org='pypy', branch='default', verbose=False):
+ url = 'https://bitbucket.org/{}/externals'.format(org)
+ if not os.path.exists(dest):
+ cmd = ['hg','clone',url,dest]
+ runcmd(cmd, verbose)
+ cmd = ['hg','-R', dest, 'update',branch]
+ runcmd(cmd, verbose)
+
+def extract_zip(externals_dir, zip_path):
+ with zipfile.ZipFile(os.fspath(zip_path)) as zf:
+ zf.extractall(os.fspath(externals_dir))
+ return externals_dir / zf.namelist()[0].split('/')[0]
+
+def parse_args():
+ p = argparse.ArgumentParser()
+ p.add_argument('-v', '--verbose', action='store_true')
+ p.add_argument('-O', '--organization',
+ help='Organization owning the deps repos', default='pypy')
+ p.add_argument('-e', '--externals', default=host.externals,
+ help='directory in which to store dependencies',
+ )
+ p.add_argument('-b', '--branch', default=host.external_branch,
+ help='branch to check out',
+ )
+ return p.parse_args()
+
+
+def main():
+ args = parse_args()
+ checkout_repo(
+ dest=args.externals,
+ org=args.organization,
+ branch=args.branch,
+ verbose=args.verbose,
+ )
+
+if __name__ == '__main__':
+ main()