|
3 | 3 | _get_platform, |
4 | 4 | _get_download_dir, |
5 | 5 | _get_binary_name, |
| 6 | + _is_binary_local, |
6 | 7 | _setup, |
7 | 8 | _get_version, |
8 | 9 | _format_auth |
@@ -262,19 +263,27 @@ def __init__(self, |
262 | 263 |
|
263 | 264 | # get or download the stackql binary |
264 | 265 | binary = _get_binary_name(this_os) |
265 | | - # if download_dir not set, use site.getuserbase() |
266 | | - if download_dir is None: |
267 | | - self.download_dir = _get_download_dir() |
268 | | - else: |
269 | | - self.download_dir = download_dir |
270 | | - self.bin_path = os.path.join(self.download_dir, binary) |
271 | | - # get and set version |
272 | | - if os.path.exists(self.bin_path): |
| 266 | + |
| 267 | + # check if the binary exists locally for Linux |
| 268 | + if this_os == 'Linux' and _is_binary_local(this_os) and download_dir is None: |
| 269 | + self.bin_path = '/usr/local/bin/stackql' |
| 270 | + self.download_dir = '/usr/local/bin' |
| 271 | + # get and set version |
273 | 272 | self.version, self.sha = _get_version(self.bin_path) |
274 | 273 | else: |
275 | | - # not installed, download |
276 | | - _setup(self.download_dir, this_os) |
277 | | - self.version, self.sha = _get_version(self.bin_path) |
| 274 | + # if download_dir not set, use site.getuserbase() or the provided path |
| 275 | + if download_dir is None: |
| 276 | + self.download_dir = _get_download_dir() |
| 277 | + else: |
| 278 | + self.download_dir = download_dir |
| 279 | + self.bin_path = os.path.join(self.download_dir, binary) |
| 280 | + # get and set version |
| 281 | + if os.path.exists(self.bin_path): |
| 282 | + self.version, self.sha = _get_version(self.bin_path) |
| 283 | + else: |
| 284 | + # not installed, download |
| 285 | + _setup(self.download_dir, this_os) |
| 286 | + self.version, self.sha = _get_version(self.bin_path) |
278 | 287 |
|
279 | 288 | # if custom_auth is set, use it |
280 | 289 | if custom_auth is not None: |
|
0 commit comments