setup.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-"
  3. """
  4. [pArAnoIA_Browser] by /psy (https://browser.03c8.net/)/ - 2020/2024
  5. You should have received a copy of the GNU General Public License along
  6. with pArAnoIA-Browser; if not, write to the Free Software Foundation, Inc., 51
  7. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  8. """
  9. import sys, time
  10. if sys.version_info[0] != 3:
  11. sys.exit("Sorry, pArAnoIA-Browser requires Python >= 3")
  12. libs = ("GeoIP", "python-geoip", "pygeoip", "requests", "pgi", "PyGObject")
  13. import subprocess, os
  14. def checkeuid():
  15. try:
  16. euid = os.geteuid()
  17. except:
  18. sys.exit(2) # return
  19. return euid
  20. def install(package):
  21. subprocess.run(["python3", "-m", "pip", "install", "--upgrade", "pip", "--no-warn-script-location", "--root-user-action=ignore"])
  22. subprocess.run(["python3", "-m", "pip", "install", "pycurl", "--upgrade", "--no-warn-script-location", "--root-user-action=ignore"])
  23. for lib in libs:
  24. subprocess.run(["python3", "-m", "pip", "install", lib, "--no-warn-script-location", "--ignore-installed", "--root-user-action=ignore"])
  25. if __name__ == '__main__':
  26. euid = checkeuid()
  27. if euid != 0:
  28. try:
  29. args = ['sudo', sys.executable] + sys.argv + [os.environ]
  30. os.execlpe('sudo', *args)
  31. except:
  32. sys.exit()
  33. sys.exit()
  34. os.system("sudo apt-get install -y --no-install-recommends python3-geoip python3-requests libgeoip1 libgeoip-dev python3-gi libcairo2-dev libgirepository1.0-dev gir1.2-webkit-3.0")
  35. install(libs)
  36. print("\n[pArAnoIA] Setup has been completed!. You can now try to run: python3 pArAnoIA.py\n")