Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A firefox-extension AUR package. #105

Open
m00nwtchr opened this issue Jan 23, 2023 · 5 comments
Open

A firefox-extension AUR package. #105

m00nwtchr opened this issue Jan 23, 2023 · 5 comments

Comments

@m00nwtchr
Copy link

As you can see in https://wiki.archlinux.org/title/Browser_extensions browser extensions themselves can also be packaged, it'd be nice to have the extension side of pywalfox in the AUR as well :)

@m00nwtchr
Copy link
Author

m00nwtchr commented Jan 23, 2023

Also side note for the existing native messaging host package: the manifest should probably be placed by the package in /usr/lib/mozilla/native-messaging-hosts/ (according to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#linux) instead of requiring the user to manually execute a command. (especially since the command will incorrectly try to chmod something in a inaccessible due to permissions location, causing an error that doesn't actually prevent the app from working, since the package already installs the files with the correct permissions)

@Frewacom
Copy link
Owner

Hi,

Yes, that would be very nice. I might have a look in the future if I find the time, but feel free to contribute your own PKGBUILD to the AUR if you want to 👍🏼

Also side note for the existing native messaging host package: the manifest should probably be placed by the package in /usr/lib/mozilla/native-messaging-hosts/ (according to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#linux) instead of requiring the user to manually execute a command. (especially since the command will incorrectly try to chmod something in a inaccessible due to permissions location, when the package can just make sure all the files are installed with the correct permissions)

Good point. I think the path to the messenger host is inserted dynamically into the manifest when you run pywalfox install, but that should not be an issue, since I assume you have access to the output path of the package.

@m00nwtchr
Copy link
Author

m00nwtchr commented Jan 23, 2023

Yep, this is how I'd do it, though:

diff --git a/PKGBUILD b/PKGBUILD
index da8c2de..ddae0dd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,6 +18,12 @@ makedepends=(
 source=("$pkgname-$pkgver.tar.gz::https://pypi.python.org/packages/source/p/$_name/$_name-$pkgver.tar.gz")
 sha256sums=('59e73d7e27389574fb801634e03d8471f09bfe062865cad803f68c456680ed66')
 
+prepare() {
+    cd $_name-$pkgver
+    local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
+    sed -i "s:<path>:$site_packages/pywalfox/bin/main.sh:" pywalfox/assets/manifest.json
+}
+
 build() {
     cd $_name-$pkgver
     python setup.py build
@@ -26,4 +32,5 @@ build() {
 package() {
     cd $_name-$pkgver
     python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+    install -Dm644 pywalfox/assets/manifest.json -T "$pkgdir/usr/lib/mozilla/native-messaging-hosts/pywalfox.json"
 }

(site_packages location script from Arch wiki, https://wiki.archlinux.org/title/Python_package_guidelines#Using_site-packages)

@Frewacom
Copy link
Owner

Thanks!

Have you tested it locally to see if it works as expected?

@m00nwtchr
Copy link
Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants