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

make.py: fix trailing slash problem #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ If you are looking for downloads go here: http://addons.getnightingale.com/

You can use the script make.py to generate xpi files like this:
```shell
python make.py <add-on_folder>
````

(add-on_folder without trailing slash)
./make.py <add-on_folder>
```
6 changes: 4 additions & 2 deletions make.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

import os
import sys
from zipfile import ZipFile
Expand All @@ -9,7 +11,7 @@
install = parse(os.path.join(sys.argv[1], "install.rdf"))
element = install.getElementsByTagName("em:version")[0]
version = element.firstChild.data
xpiName = sys.argv[1] + "-" + version + ".xpi"
xpiName = sys.argv[1].rstrip("/") + "-" + version + ".xpi"
xpi = ZipFile(xpiName, "w")
os.chdir(sys.argv[1])
for root, dirs, files in os.walk("."):
Expand All @@ -18,7 +20,7 @@
xpi.write(path, path, 8)
xpi.close()
os.chdir("..")
if os.path.exists(xpiName):
if os.path.exists(os.path.basename(xpiName)):
print(xpiName + " successfully written.")
else:
sys.exit(xpiName + " could not be written.")