From d6536fabf818f98e323ee6d2fbc2bbf077860058 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 2 May 2019 07:32:45 -0700 Subject: [PATCH 1/2] Derive the libuast os/arch selector from sys.platform. Part of the pyuast build process fetches a binary release of libuast. Previously, the release version was pinned to linux-amd64. This change makes it consult sys.platform. Unfortunately, sys.platform doesn't exactly match the release tag for windows, but since we only have binary releases for Linux, Darwin, and Windows anyway, it is a straightforward patch. The default remains linux-amd64 in case someone has another platform; if it was wrong before it will still be wrong, but in the same way. Signed-off-by: M. J. Fromberger --- setup.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 897194a..27d34b6 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,6 @@ # You may change the contents of the string, but do not otherwise edit the line. VERSION = "3.x.x-dev" LIBUAST_VERSION = "v3.3.0" -LIBUAST_ARCH = "linux-amd64" SDK_V1_VERSION = "v1.17.0" SDK_V1_MAJOR = SDK_V1_VERSION.split('.')[0] SDK_V2_VERSION = "v2.16.4" @@ -132,6 +131,18 @@ def create_inits(sdk_major): open(f, "w").close() +def get_libuast_arch(): + """Return the os-arch tag to use when fetching libuast. + """ + + # See https://github.com/bblfsh/client-python/issues/156. + if sys.platform == 'win32': + return 'windows-amd64' + elif sys.platform: + return sys.platform + '-amd64' + return 'linux-amd64' + + def get_libuast(): if not GET_LIBUAST: return @@ -141,8 +152,9 @@ def get_libuast(): mkdir(local_libuast) # Retrieve libuast - untar_url("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/bblfsh/libuast/releases/download/%s/libuast-%s.tar.gz" % (LIBUAST_VERSION, LIBUAST_ARCH)) - mv(LIBUAST_ARCH, local_libuast) + untar_url("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/bblfsh/libuast/releases/download/%s/libuast-%s.tar.gz" % ( + LIBUAST_VERSION, get_libuast_arch())) + mv(get_libuast_arch(), local_libuast) def proto_download_v1(): From d897c7cbb7208b7924d7671228191ea30c71384b Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 2 May 2019 16:10:34 -0700 Subject: [PATCH 2/2] Pin libuast to v3.3.1, to pick up libuast.a for macOS. Part of the fix for #156. Signed-off-by: M. J. Fromberger --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 27d34b6..881e92b 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ # The VERSION line is edited automatically during deployments. # You may change the contents of the string, but do not otherwise edit the line. VERSION = "3.x.x-dev" -LIBUAST_VERSION = "v3.3.0" +LIBUAST_VERSION = "v3.3.1" SDK_V1_VERSION = "v1.17.0" SDK_V1_MAJOR = SDK_V1_VERSION.split('.')[0] SDK_V2_VERSION = "v2.16.4"