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

make.py: fix trailing slash problem #21

wants to merge 3 commits into from

Conversation

darealshinji
Copy link
Contributor

No description provided.

@darealshinji darealshinji changed the title fix trailing slash problem make.py: fix trailing slash problem Sep 1, 2014
@rsjtdrjgfuzkfg
Copy link
Member

Hm. From scrolling through this seems not to work if somebody uses a path for the folder (so you have multiple "/" in the path); I don't know python enough to be sure about this, though.

@darealshinji
Copy link
Contributor Author

It seems to work, in a weird way though:

djcj ~ $ ./make.py Downloads/nightingale-addons-master/equalizerpane/
Downloadsnightingale-addons-masterequalizerpane-1.0.11.xpi could not be written.
djcj ~ $ ls *.xpi
Downloadsnightingale-addons-masterequalizerpane-1.0.11.xpi
djcj ~ $ 

@rsjtdrjgfuzkfg
Copy link
Member

I wouldn't call it working. It is what I expected :P

@freaktechnik
Copy link
Member

Couldn't you use a simple regular expression with something like .sub("/$", "")?

@darealshinji
Copy link
Contributor Author

I'll see what I can do, but to be honest I don't know too much about writing python scripts.

edit:
What about using a shell script instead?

#!/bin/sh

if [ -z "$1" ] ; then
  echo "usage: $0 <path>"
  exit 1
fi

version=$(grep -e "em:version" "$1"/install.rdf | cut -d '>' -f2 | cut -d '<' -f1)
xpiName=$(echo $(basename "$1")-$version.xpi)
basedir=$(pwd)

cd "$1" && zip -r "$basedir/$xpiName" ./*

if [ -f "$basedir/$xpiName" ] ; then
  echo "'$basedir/$xpiName' successfully written."
  exit 0
else
  echo "'$basedir/$xpiName' could not be written."
  exit 1
fi

@clokep
Copy link
Member

clokep commented Sep 14, 2014

The regular expression that kills the trailing / only seems like the best way to go.

@darealshinji
Copy link
Contributor Author

I've got it. Now it only removes the trailing slash and make.py can be run from other directories.

@darealshinji
Copy link
Contributor Author

So, do you want this fix or should I close this PR?

@rsjtdrjgfuzkfg
Copy link
Member

Looks fine to me, although I didn't test it. Imho some notes about where to find the built file (after the patch: in the working directory if I read this right) would be fine in the readme as well, but that should not oppose a merge.

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

Successfully merging this pull request may close these issues.

4 participants