Conversation
|
Nice 👍 I just checked, However, archs.py already adds |
|
Thanks for reviewing code. I further considered and tested the following point:
As a result, I think the possibility of doubly applying The And these shared objects are NOT stripped devoid of this function. On the other hand, shared objects belonging to regular recipes are independent of I performed a test build with |
Sure, but that's not what I suggested. I think the |
|
Excuse me, I was talking about different thing 😓 Now, for example, when So we won't get |
|
@j-devel regarding I was more thinking of considering where |
pythonforandroid/bootstrap.py
Outdated
| return | ||
| strip = sh.Command(strip) | ||
| tokens = env['STRIP'].split(' ') | ||
| strip = reduce(lambda cmd, t: cmd.bake(t), tokens, sh.Command(tokens.pop(0))) |
There was a problem hiding this comment.
Ok I played around with this, and it appears this can be written as:
tokens = env['STRIP'].split(' ')
strip = sh.Command(tokens[0]).bake(tokens[1:])
I would suggest that would be a little more readable
(This also works when len(token) == 1 and consequently tokens[:1] == [], I tested that special case)
Sorry I really didn't want to go on about this forever from my initial duplicate option nitpick, I hope I'm not wearing you out too much 😬 but the reduce/lambda variant is a little hard to read
There was a problem hiding this comment.
Additional note: as written above I just noticed the space char splitting could break things.
tokens = shlex.split(env['STRIP'])
strip = sh.Command(tokens[0]).bake(tokens[1:])
This should work correctly (requires import shlex at the beginning of the file, which is a core/stdlib module as far as I'm aware)
There was a problem hiding this comment.
I really appreciate your support 😄
I like your simpler version and tested it fine. (But, in
(This also works when
len(token) == 1and consequentlytokens[:1] == [], I tested that special case)
I am sure you are meaning tokens[1:] == [] not [:1]).
I am pushing a new commit...
inclement
left a comment
There was a problem hiding this comment.
Looks like there are some pep8 issues breaking travis, would you be able to fix that too? It shouldn't be anything complicated.
pythonforandroid/bootstrap.py
Outdated
| return | ||
| strip = sh.Command(strip) | ||
| tokens = shlex.split(env['STRIP']) | ||
| strip = sh.Command(tokens[0]).bake(tokens[1:]) |
There was a problem hiding this comment.
It looks like this still assumes that that env['STRIP'] will split to a list of length at least two, which seems not necessarily true. Could you add a check to only bake the extra tokens if they exist?
There was a problem hiding this comment.
Added the check in 7ad0207.
Looks like there are some pep8 issues breaking travis
I would like to look into this issue soon and come back.
There was a problem hiding this comment.
@j-devel @inclement .bake works fine with an empty list. the if condition is not necessary, the above code works fine even for a single argument. (array slices outside of the array's range don't result in an error either, it just results in an empty list)
| strip = sh.Command(strip) | ||
| tokens = shlex.split(env['STRIP']) | ||
| strip = sh.Command(tokens[0]) | ||
| if len(tokens) > 1: |
There was a problem hiding this comment.
have you tested this without the if and a single argument/len(tokens) == 1? I tested bake with an empty list and it worked fine, I'm pretty sure this conditional is not required
There was a problem hiding this comment.
Oh, you're quite right, I misremembered what list slice syntax would do outside the bounds of the list. It's fine to revert this.
There was a problem hiding this comment.
@Jonast Yes, I tested the len(tokens) == 1 case, and it basically works. But, I found that .bake() raises a complaint when it's argument is [] (see the following REPL test).
>>> import sh
>>> sh.Command('strip').bake([])
__main__:1: UserWarning: Empty list passed as an argument to '/opt/local/bin/strip'. If you're using glob.glob(), please use sh.glob() instead.
If we want to eliminate this warning, I think we still need the if check. Thoughts? @Jonast @inclement
There was a problem hiding this comment.
@j-devel oh weird, have never seen that (maybe I got a different version?). In that case definitely keep the check in
| info('Python was loaded from CrystaX, skipping strip') | ||
| return | ||
| env = arch.get_env() | ||
| strip = which('arm-linux-androideabi-strip', env['PATH']) |
There was a problem hiding this comment.
Since which is not used anymore, would you mind removing the import to please the CI 🙏
pythonforandroid/bootstrap.py:12:1: F401 'pythonforandroid.util.which' imported but unused
There was a problem hiding this comment.
Done. Sorry about the CI. Thanks for your help.
|
Great, thanks! |
Due to hardcoding, the arch-dependent
stripcommand is not invoked when building forarchother than--arch=armeabi-v7a(e.g.stripnot detected when--arch=x86).This PR fixes
striperroneously when the file name is''(an empty string).