distroscript 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {distroscript-0.2.0 → distroscript-0.2.1}/PKG-INFO +6 -4
- {distroscript-0.2.0 → distroscript-0.2.1}/README.md +5 -3
- {distroscript-0.2.0 → distroscript-0.2.1}/src/distroscript.py +29 -22
- {distroscript-0.2.0 → distroscript-0.2.1}/src/schema.json +18 -1
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/17-appimage.yml +5 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/17-appimage.sh +4 -2
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/17-appimage.sh +4 -2
- {distroscript-0.2.0 → distroscript-0.2.1}/.gitignore +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/LICENSE +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/pyproject.toml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/01-package.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/02-package-default-name.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/03-package-type-only.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/04-pre-post_install.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/05-flags.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/06-depends_on.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/07-snapd.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/08-flatpak.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/09-tarball.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/10-github.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/11-file.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/12-pip.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/13-shell.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/14-zip.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/15-transitive-deps.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/inputs/16-install-first-option.yml +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/01-package.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/02-package-default-name.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/03-package-type-only.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/04-pre-post_install.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/05-flags.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/06-depends_on.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/07-snapd.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/08-flatpak.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/09-tarball.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/10-github.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/11-file.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/12-pip.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/13-shell.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/14-zip.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/15-transitive-deps.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/fedora/16-install-first-option.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/01-package.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/02-package-default-name.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/03-package-type-only.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/04-pre-post_install.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/07-snapd.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/08-flatpak.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/09-tarball.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/10-github.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/11-file.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/12-pip.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/13-shell.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/14-zip.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/outputs/ubuntu/15-transitive-deps.sh +0 -0
- {distroscript-0.2.0 → distroscript-0.2.1}/tests/run_tests.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: distroscript
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Generate Bash installation scripts from a declarative YAML config for multiple Linux distros
|
|
5
5
|
Project-URL: Homepage, https://github.com/RaniAgus/distroscript
|
|
6
6
|
Project-URL: Repository, https://github.com/RaniAgus/distroscript
|
|
@@ -416,14 +416,16 @@ obsidian:
|
|
|
416
416
|
icon_name: obsidian
|
|
417
417
|
mime_types:
|
|
418
418
|
- x-scheme-handler/obsidian
|
|
419
|
+
- type: text/markdown
|
|
420
|
+
default: true
|
|
419
421
|
```
|
|
420
422
|
|
|
421
423
|
AppImages are downloaded to `$HOME/.local/bin/`, a desktop entry is created in
|
|
422
424
|
`$HOME/.local/share/applications/`, and icons are extracted automatically when `icon_name` is specified.
|
|
423
425
|
|
|
424
|
-
When `mime_types` is provided, the desktop entry advertises those MIME types
|
|
425
|
-
|
|
426
|
-
|
|
426
|
+
When `mime_types` is provided, the desktop entry advertises those MIME types. If `default` is not set, only scheme
|
|
427
|
+
handler strings register the AppImage as their default handler, other MIME types will not be set as default unless
|
|
428
|
+
`default: true` is explicitly specified.
|
|
427
429
|
|
|
428
430
|
> [!NOTE]
|
|
429
431
|
> AppImage packages require the `url` field. The `name`, `icon_name`, `categories`, and `mime_types` fields are optional.
|
|
@@ -372,14 +372,16 @@ obsidian:
|
|
|
372
372
|
icon_name: obsidian
|
|
373
373
|
mime_types:
|
|
374
374
|
- x-scheme-handler/obsidian
|
|
375
|
+
- type: text/markdown
|
|
376
|
+
default: true
|
|
375
377
|
```
|
|
376
378
|
|
|
377
379
|
AppImages are downloaded to `$HOME/.local/bin/`, a desktop entry is created in
|
|
378
380
|
`$HOME/.local/share/applications/`, and icons are extracted automatically when `icon_name` is specified.
|
|
379
381
|
|
|
380
|
-
When `mime_types` is provided, the desktop entry advertises those MIME types
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
When `mime_types` is provided, the desktop entry advertises those MIME types. If `default` is not set, only scheme
|
|
383
|
+
handler strings register the AppImage as their default handler, other MIME types will not be set as default unless
|
|
384
|
+
`default: true` is explicitly specified.
|
|
383
385
|
|
|
384
386
|
> [!NOTE]
|
|
385
387
|
> AppImage packages require the `url` field. The `name`, `icon_name`, `categories`, and `mime_types` fields are optional.
|
|
@@ -16,10 +16,10 @@ import json
|
|
|
16
16
|
from jsonschema import validate, ValidationError
|
|
17
17
|
import os
|
|
18
18
|
import sys
|
|
19
|
-
from typing import ClassVar, Generic, TypeVar
|
|
19
|
+
from typing import ClassVar, Generic, TypeVar, TypedDict
|
|
20
20
|
import yaml
|
|
21
21
|
|
|
22
|
-
__version__ = "0.2.
|
|
22
|
+
__version__ = "0.2.1"
|
|
23
23
|
|
|
24
24
|
def main(args: argparse.Namespace) -> None:
|
|
25
25
|
"""
|
|
@@ -189,6 +189,11 @@ PLATFORMS = {
|
|
|
189
189
|
|
|
190
190
|
T = TypeVar('T', bound='Package')
|
|
191
191
|
|
|
192
|
+
|
|
193
|
+
class MimeType(TypedDict):
|
|
194
|
+
type: str
|
|
195
|
+
default: bool
|
|
196
|
+
|
|
192
197
|
@dataclass(frozen=True)
|
|
193
198
|
class Package(ABC, Generic[T]):
|
|
194
199
|
factories: ClassVar[dict[str, type[Package]]] = {}
|
|
@@ -863,7 +868,20 @@ class AppImagePackage(Package, type='appimage'):
|
|
|
863
868
|
def create(cls, name: str, item: dict, platform: Platform) -> list[Package]:
|
|
864
869
|
url = item.get('url')
|
|
865
870
|
icon_name = item.get('icon_name')
|
|
866
|
-
mime_types =
|
|
871
|
+
mime_types: list[MimeType] = []
|
|
872
|
+
for mime_type in item.get('mime_types', []):
|
|
873
|
+
if isinstance(mime_type, str):
|
|
874
|
+
mime_types.append({
|
|
875
|
+
'type': mime_type,
|
|
876
|
+
'default': mime_type.startswith('x-scheme-handler/'),
|
|
877
|
+
})
|
|
878
|
+
else:
|
|
879
|
+
mime_type_name = mime_type.get('type')
|
|
880
|
+
mime_types.append({
|
|
881
|
+
'type': mime_type_name,
|
|
882
|
+
'default': mime_type.get('default', mime_type_name.startswith('x-scheme-handler/')),
|
|
883
|
+
})
|
|
884
|
+
mime_type_names = [mime_type['type'] for mime_type in mime_types]
|
|
867
885
|
|
|
868
886
|
if not url:
|
|
869
887
|
raise RuntimeError(f"AppImagePackage requires 'url' field.")
|
|
@@ -881,15 +899,6 @@ class AppImagePackage(Package, type='appimage'):
|
|
|
881
899
|
categories = item.get('categories', 'Application')
|
|
882
900
|
if isinstance(categories, str):
|
|
883
901
|
categories = [categories]
|
|
884
|
-
has_scheme_handler = any(
|
|
885
|
-
mime_type.startswith('x-scheme-handler/')
|
|
886
|
-
for mime_type in mime_types
|
|
887
|
-
)
|
|
888
|
-
exec_command = (
|
|
889
|
-
f"sh -c '\"{destination}\" \"$1\"' sh %u"
|
|
890
|
-
if has_scheme_handler
|
|
891
|
-
else f'sh -c "{destination}"'
|
|
892
|
-
)
|
|
893
902
|
|
|
894
903
|
# Desktop file creation
|
|
895
904
|
desktop_entry = []
|
|
@@ -901,9 +910,9 @@ class AppImagePackage(Package, type='appimage'):
|
|
|
901
910
|
desktop_entry.append(f'Categories={";".join(categories)};')
|
|
902
911
|
if icon_name:
|
|
903
912
|
desktop_entry.append(f'Icon={icon_name}')
|
|
904
|
-
if
|
|
905
|
-
desktop_entry.append(f'MimeType={";".join(
|
|
906
|
-
desktop_entry.append(f'Exec={
|
|
913
|
+
if mime_type_names:
|
|
914
|
+
desktop_entry.append(f'MimeType={";".join(mime_type_names)};')
|
|
915
|
+
desktop_entry.append(f'Exec=sh -c \'"{destination}" "$1"\' sh %u')
|
|
907
916
|
desktop_entry.append('')
|
|
908
917
|
|
|
909
918
|
post_install.append(
|
|
@@ -914,15 +923,13 @@ class AppImagePackage(Package, type='appimage'):
|
|
|
914
923
|
)
|
|
915
924
|
)
|
|
916
925
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
f'xdg-mime default {desktop_file} {mime_type}'
|
|
922
|
-
for mime_type in mime_types
|
|
926
|
+
for mime_type in mime_types:
|
|
927
|
+
if mime_type.get('default', False):
|
|
928
|
+
post_install.append(
|
|
929
|
+
ShellCommand(
|
|
930
|
+
command=f'xdg-mime default {desktop_file} {mime_type["type"]}'
|
|
923
931
|
)
|
|
924
932
|
)
|
|
925
|
-
)
|
|
926
933
|
|
|
927
934
|
# Icon extraction if icon_name is provided
|
|
928
935
|
if icon_name:
|
|
@@ -547,7 +547,24 @@
|
|
|
547
547
|
"mime_types": {
|
|
548
548
|
"type": "array",
|
|
549
549
|
"items": {
|
|
550
|
-
"
|
|
550
|
+
"oneOf": [
|
|
551
|
+
{
|
|
552
|
+
"type": "string"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"type": "object",
|
|
556
|
+
"required": ["type"],
|
|
557
|
+
"properties": {
|
|
558
|
+
"type": {
|
|
559
|
+
"type": "string"
|
|
560
|
+
},
|
|
561
|
+
"default": {
|
|
562
|
+
"type": "boolean"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
"additionalProperties": false
|
|
566
|
+
}
|
|
567
|
+
]
|
|
551
568
|
}
|
|
552
569
|
},
|
|
553
570
|
"depends_on": {
|
|
@@ -29,7 +29,7 @@ Type=Application
|
|
|
29
29
|
Terminal=false
|
|
30
30
|
Categories=Game;Emulator;
|
|
31
31
|
Icon=org.duckstation.DuckStation
|
|
32
|
-
Exec=sh -c "$HOME/.local/bin/DuckStation.AppImage"
|
|
32
|
+
Exec=sh -c '"$HOME/.local/bin/DuckStation.AppImage" "$1"' sh %u
|
|
33
33
|
EOF
|
|
34
34
|
|
|
35
35
|
(
|
|
@@ -52,8 +52,10 @@ StartupNotify=true
|
|
|
52
52
|
Type=Application
|
|
53
53
|
Terminal=false
|
|
54
54
|
Categories=Application;
|
|
55
|
-
MimeType=x-scheme-handler/obsidian;
|
|
55
|
+
MimeType=x-scheme-handler/obsidian;application/x-obsidian-vault;text/markdown;x-scheme-handler/obsidian-dev;
|
|
56
56
|
Exec=sh -c '"$HOME/.local/bin/Obsidian.AppImage" "$1"' sh %u
|
|
57
57
|
EOF
|
|
58
58
|
|
|
59
59
|
xdg-mime default Obsidian.desktop x-scheme-handler/obsidian
|
|
60
|
+
|
|
61
|
+
xdg-mime default Obsidian.desktop text/markdown
|
|
@@ -29,7 +29,7 @@ Type=Application
|
|
|
29
29
|
Terminal=false
|
|
30
30
|
Categories=Game;Emulator;
|
|
31
31
|
Icon=org.duckstation.DuckStation
|
|
32
|
-
Exec=sh -c "$HOME/.local/bin/DuckStation.AppImage"
|
|
32
|
+
Exec=sh -c '"$HOME/.local/bin/DuckStation.AppImage" "$1"' sh %u
|
|
33
33
|
EOF
|
|
34
34
|
|
|
35
35
|
(
|
|
@@ -52,8 +52,10 @@ StartupNotify=true
|
|
|
52
52
|
Type=Application
|
|
53
53
|
Terminal=false
|
|
54
54
|
Categories=Application;
|
|
55
|
-
MimeType=x-scheme-handler/obsidian;
|
|
55
|
+
MimeType=x-scheme-handler/obsidian;application/x-obsidian-vault;text/markdown;x-scheme-handler/obsidian-dev;
|
|
56
56
|
Exec=sh -c '"$HOME/.local/bin/Obsidian.AppImage" "$1"' sh %u
|
|
57
57
|
EOF
|
|
58
58
|
|
|
59
59
|
xdg-mime default Obsidian.desktop x-scheme-handler/obsidian
|
|
60
|
+
|
|
61
|
+
xdg-mime default Obsidian.desktop text/markdown
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|