Ran autopep8
This commit is contained in:
parent
d018ae98a1
commit
5d2b11e60f
|
|
@ -1,13 +1,18 @@
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import archinstall, sys, os, glob
|
import archinstall
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
# TODO: Learn the dark arts of argparse...
|
# TODO: Learn the dark arts of argparse...
|
||||||
# (I summon thee dark spawn of cPython)
|
# (I summon thee dark spawn of cPython)
|
||||||
|
|
||||||
|
|
||||||
class ProfileNotFound(BaseException):
|
class ProfileNotFound(BaseException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def find_examples():
|
def find_examples():
|
||||||
"""
|
"""
|
||||||
Used to locate the examples, bundled with the module or executable.
|
Used to locate the examples, bundled with the module or executable.
|
||||||
|
|
@ -20,6 +25,7 @@ def find_examples():
|
||||||
|
|
||||||
return {os.path.basename(path): path for path in glob.glob(f'{examples}/*.py')}
|
return {os.path.basename(path): path for path in glob.glob(f'{examples}/*.py')}
|
||||||
|
|
||||||
|
|
||||||
def find(url):
|
def find(url):
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
if not parsed_url.scheme:
|
if not parsed_url.scheme:
|
||||||
|
|
@ -35,13 +41,15 @@ def find(url):
|
||||||
else:
|
else:
|
||||||
return ProfileNotFound(f"Cannot handle scheme {parsed_url.scheme}")
|
return ProfileNotFound(f"Cannot handle scheme {parsed_url.scheme}")
|
||||||
|
|
||||||
|
|
||||||
def run_as_a_module():
|
def run_as_a_module():
|
||||||
"""
|
"""
|
||||||
Since we're running this as a 'python -m archinstall' module OR
|
Since we're running this as a 'python -m archinstall' module OR
|
||||||
a nuitka3 compiled version of the project.
|
a nuitka3 compiled version of the project.
|
||||||
This function and the file __main__ acts as a entry point.
|
This function and the file __main__ acts as a entry point.
|
||||||
"""
|
"""
|
||||||
if len(sys.argv) == 1: sys.argv.append('guided')
|
if len(sys.argv) == 1:
|
||||||
|
sys.argv.append('guided')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
profile = find(sys.argv[1])
|
profile = find(sys.argv[1])
|
||||||
|
|
@ -55,5 +63,6 @@ def run_as_a_module():
|
||||||
print(f"Failed to run profile... {err}")
|
print(f"Failed to run profile... {err}")
|
||||||
sys.exit(1) # Should prompt for another profile path instead
|
sys.exit(1) # Should prompt for another profile path instead
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run_as_a_module()
|
run_as_a_module()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue