Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit d6536fa

Browse files
committed
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 <michael.j.fromberger@gmail.com>
1 parent 815835d commit d6536fa

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

setup.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# You may change the contents of the string, but do not otherwise edit the line.
1717
VERSION = "3.x.x-dev"
1818
LIBUAST_VERSION = "v3.3.0"
19-
LIBUAST_ARCH = "linux-amd64"
2019
SDK_V1_VERSION = "v1.17.0"
2120
SDK_V1_MAJOR = SDK_V1_VERSION.split('.')[0]
2221
SDK_V2_VERSION = "v2.16.4"
@@ -132,6 +131,18 @@ def create_inits(sdk_major):
132131
open(f, "w").close()
133132

134133

134+
def get_libuast_arch():
135+
"""Return the os-arch tag to use when fetching libuast.
136+
"""
137+
138+
# See https://github.com/bblfsh/client-python/issues/156.
139+
if sys.platform == 'win32':
140+
return 'windows-amd64'
141+
elif sys.platform:
142+
return sys.platform + '-amd64'
143+
return 'linux-amd64'
144+
145+
135146
def get_libuast():
136147
if not GET_LIBUAST:
137148
return
@@ -141,8 +152,9 @@ def get_libuast():
141152
mkdir(local_libuast)
142153

143154
# Retrieve libuast
144-
untar_url("https://github.com/bblfsh/libuast/releases/download/%s/libuast-%s.tar.gz" % (LIBUAST_VERSION, LIBUAST_ARCH))
145-
mv(LIBUAST_ARCH, local_libuast)
155+
untar_url("https://github.com/bblfsh/libuast/releases/download/%s/libuast-%s.tar.gz" % (
156+
LIBUAST_VERSION, get_libuast_arch()))
157+
mv(get_libuast_arch(), local_libuast)
146158

147159

148160
def proto_download_v1():

0 commit comments

Comments
 (0)