tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

detect_host_arch.py (818B)


      1 #!/usr/bin/env python3
      2 #
      3 # This Source Code Form is subject to the terms of the Mozilla Public
      4 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 # You can obtain one at http://mozilla.org/MPL/2.0/.
      6 
      7 from __future__ import print_function
      8 
      9 import fnmatch
     10 import platform
     11 
     12 def main():
     13    host_arch = platform.machine().lower()
     14    if host_arch in ('amd64', 'x86_64'):
     15        host_arch = 'x64'
     16    elif fnmatch.fnmatch(host_arch, 'i?86') or host_arch == 'i86pc':
     17        host_arch = 'ia32'
     18    elif host_arch == 'arm64':
     19        pass
     20    elif host_arch.startswith('arm'):
     21        host_arch = 'arm'
     22    elif host_arch.startswith('mips64'):
     23        host_arch = 'mips64'
     24    elif host_arch.startswith('mips'):
     25        host_arch = 'mips'
     26    print(host_arch)
     27 
     28 if __name__ == '__main__':
     29    main()