Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/profiles.py39
-rwxr-xr-xmake.sh2
2 files changed, 13 insertions, 28 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index c1e2f8a9..f0de62d3 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -14,6 +14,16 @@ def grab_url_data(path):
response = urllib.request.urlopen(safe_path, context=ssl_context)
return response.read()
+def list_profiles(base='./profiles/'):
+ # TODO: Grab from github page as well, not just local static files
+ cache = {}
+ for root, folders, files in os.walk(base):
+ for file in files:
+ if os.path.splitext(file)[1] == '.py':
+ cache[file] = os.path.join(root, file)
+ break
+ return cache
+
class Imported():
def __init__(self, spec, imported):
self.spec = spec
@@ -44,8 +54,6 @@ class Profile():
return os.path.abspath(f'{self.name}')
for path in ['./profiles', '/etc/archinstall', '/etc/archinstall/profiles', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles')]: # Step out of /lib
- if os.path.isfile(f'{path}/{self.name}.json'):
- return os.path.abspath(f'{path}/{self.name}.json')
elif os.path.isfile(f'{path}/{self.name}.py'):
return os.path.abspath(f'{path}/{self.name}.py')
@@ -55,18 +63,6 @@ class Profile():
return f'{UPSTREAM_URL}/{self.name}.py'
except urllib.error.HTTPError:
pass
- try:
- if (cache := grab_url_data(f'{UPSTREAM_URL}/{self.name}.json')):
- self._cache = cache
- return f'{UPSTREAM_URL}/{self.name}.json'
- except urllib.error.HTTPError:
- pass
- try:
- if (cache := grab_url_data(f'{UPSTREAM_URL}/{self.name}.json')):
- self._cache = cache
- return f'{UPSTREAM_URL}/{self.name}.json'
- except urllib.error.HTTPError:
- pass
return None
@@ -80,11 +76,8 @@ class Profile():
imported = importlib.util.module_from_spec(spec)
sys.modules[os.path.basename(absolute_path)] = imported
return Imported(spec, imported)
- elif absolute_path[:4] == 'http':
- return json.loads(self._cache)
-
- with open(absolute_path, 'r') as fh:
- return json.load(fh)
+ else:
+ raise ProfileError(f'Extension {os.path.splitext(absolute_path)[1]} is not a supported profile model. Only .py is supported.')
raise ProfileError(f'No such profile ({self.name}) was found either locally or in {UPSTREAM_URL}')
@@ -190,8 +183,6 @@ class Application(Profile):
for path in ['./applications', './profiles/applications', '/etc/archinstall/applications', '/etc/archinstall/profiles/applications', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles/applications')]:
if os.path.isfile(f'{path}/{self.name}.py'):
return os.path.abspath(f'{path}/{self.name}.py')
- elif os.path.isfile(f'{path}/{self.name}.json'):
- return os.path.abspath(f'{path}/{self.name}.json')
try:
if (cache := grab_url_data(f'{UPSTREAM_URL}/applications/{self.name}.py')):
@@ -199,11 +190,5 @@ class Application(Profile):
return f'{UPSTREAM_URL}/applications/{self.name}.py'
except urllib.error.HTTPError:
pass
- try:
- if (cache := grab_url_data(f'{UPSTREAM_URL}/applications/{self.name}.json')):
- self._cache = cache
- return f'{UPSTREAM_URL}/applications/{self.name}.json'
- except urllib.error.HTTPError:
- pass
return None \ No newline at end of file
diff --git a/make.sh b/make.sh
index 46d2d00d..82333a5f 100755
--- a/make.sh
+++ b/make.sh
@@ -6,7 +6,7 @@ rm -rf archinstall.egg-info/ build/ src/ pkg/ dist/ archinstall.build/ archinsta
nuitka3 --standalone --show-progress archinstall
cp -r examples/ archinstall.dist/
mv archinstall.dist archinstall-v2.0.4rc4-x86_64
-tar -czvf archinstall-v2.0.4rc4.tar.gz archinstall-v2.0.4rc4-x86_64
+tar -czvf archinstall-v2.0.4rc4-x86_64.tar.gz archinstall-v2.0.4rc4-x86_64
makepkg -f
python3 setup.py sdist bdist_wheel