1
1
"""Get the link to download Fx or Geckodriver, for any supported platform.
2
2
Use -g to get geckodriver, otherwise you will get Fx. Use -n to just get the Fx version number.
3
3
Set env var FX_CHANNEL to get non-beta, blank string for Release.
4
- Set env var FX_LOCALE to get a different locale build."""
4
+ Set env var FX_LOCALE to get a different locale build.
5
+ Set env var FX_PLATFORM to get a platform other than current system."""
5
6
7
+ import logging
6
8
from os import environ
7
9
from platform import uname
8
10
from sys import argv , exit
9
11
from time import sleep
10
12
11
13
import requests
12
- import logging
13
14
from bs4 import BeautifulSoup
14
15
15
16
GECKO_API_URL = "https://api.github.com/repos/mozilla/geckodriver/releases/latest"
19
20
20
21
def get_fx_platform ():
21
22
u = uname ()
22
- if u .system == "Darwin" :
23
+ _system = environ .get ("FX_PLATFORM" ) or u .system
24
+ if _system == "Darwin" :
23
25
return "mac"
24
- if u . system == "Linux" :
26
+ if _system == "Linux" :
25
27
if "64" in u .machine :
26
28
return "linux-x86_64"
27
29
return "linux-i686"
28
- if u . system == "Windows" :
30
+ if _system == "Windows" :
29
31
if u .machine == "AMD64" and not environ .get ("GITHUB_ACTIONS" ):
30
32
return "win64-aarch64"
31
33
if "64" in u .machine :
@@ -35,25 +37,27 @@ def get_fx_platform():
35
37
36
38
def get_fx_executable_extension ():
37
39
u = uname ()
38
- if u .system == "Darwin" :
40
+ _system = environ .get ("FX_PLATFORM" ) or u .system
41
+ if _system == "Darwin" :
39
42
return "dmg"
40
- if u . system == "Linux" :
43
+ if _system == "Linux" :
41
44
return "xz"
42
- if u . system == "Windows" :
45
+ if _system == "Windows" :
43
46
return "exe"
44
47
45
48
46
49
def get_gd_platform ():
47
50
u = uname ()
48
- if u .system == "Darwin" :
51
+ _system = environ .get ("FX_PLATFORM" ) or u .system
52
+ if _system == "Darwin" :
49
53
return "macos"
50
- if u . system == "Linux" :
54
+ if _system == "Linux" :
51
55
if u .machine == "AMD64" :
52
56
return "linux-aarch64"
53
57
if "64" in u .machine :
54
58
return "linux64"
55
59
return "linux32"
56
- if u . system == "Windows" :
60
+ if _system == "Windows" :
57
61
if u .machine == "AMD64" and not environ .get ("GITHUB_ACTIONS" ):
58
62
return "win-aarch64"
59
63
if "64" in u .machine :
0 commit comments