-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Recipe for argon2-cffi #2398
Recipe for argon2-cffi #2398
Conversation
Try using a CompiledComponentsPythonRecipe - you'll need to do something like this to get the argon C components to build. |
I tried to look into what is a CompiledComponentsPythonRecipe but this is what it says in the documentation:
|
Is this link relevant to what you think I should look for : (https://askpythonquestions.com/2020/12/13/kivy-python-for-android-how-to-create-custom-recipes/) |
You may (also) need to set from pythonforandroid.recipe import CompiledComponentsPythonRecipe
class Argon2Recipe(CompiledComponentsPythonRecipe):
version = '20.1.0'
url = 'https://github.com/hynek/argon2-cffi/archive/master.zip'
depends = ['setuptools', 'cffi']
call_hostpython_via_targetpython = False
recipe = Argon2Recipe() |
url = 'https://github.com/hynek/argon2-cffi/archive/master.zip' | ||
depends = ['setuptools', 'cffi'] | ||
call_hostpython_via_targetpython = False | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 requires an extra blank line here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't like the fact that the "blank line" contains whitespace.
From what I understand it's still not able to compile the c? |
It can't find the argon.h file do I need to include the c code somehow? |
Looks like it uses a git submodule for the |
Try using |
shall I make my own zip with the other repo included inside this one from: https://github.com/p-h-c/phc-winner-argon2/tree/62358ba2123abd17fccf2a108a301d4b52c01a7c |
okay, sorry I typed my thing before seeing your comment |
Actually, I think that should just be Normally, you should include |
@@ -3,7 +3,7 @@ | |||
|
|||
class Argon2Recipe(CompiledComponentsPythonRecipe): | |||
version = '20.1.0' | |||
url = 'https://github.com/hynek/argon2-cffi/archive/master.zip' | |||
url = 'url = 'git+https://github.com/hynek/argon2-cffi@{version}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that doesn't look quite right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is my first pr ever, sorry if it's a bit shabby.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np. though you may want to do a rebase and squash all those intermediate commits when it's working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah okay I will do that
|
||
class Argon2Recipe(CompiledComponentsPythonRecipe): | ||
version = '20.1.0' | ||
url = 'git+https://github.com/hynek/argon2-cffi@{version}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to remove the @{version}
here. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np. I didn't see you edited that message.
Okay, I don't quite understand what the issue is now? It seemed like it almost passed it this time though |
I think the problem is that p4a calls |
I don't understand how the p4a.local_recipes works, this is what I have so far:
If I am using my own fork, then why does it need the local_recipes thing? |
Incase you are wondering if I have done a build with those settings above in me .spec file, here is the output |
In that case it doesn't :) |
Oh okay, so if I use a local recipe do I still need to specify the package in the requirement field? Also what do you think of that build output I uploaded, is that some mistake on my part? |
This recipe seems to work: from pythonforandroid.recipe import CompiledComponentsPythonRecipe
class Argon2Recipe(CompiledComponentsPythonRecipe):
version = '20.1.0'
url = 'git+https://github.com/hynek/argon2-cffi'
depends = ['setuptools', 'cffi']
call_hostpython_via_targetpython = False
build_cmd = 'build'
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
env['ARGON2_CFFI_USE_SSE2'] = '0'
return env
recipe = Argon2Recipe() |
You may run into #2400 when testing that locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and the follow up changes with the help of @inclement and @obfusk
Looking good, will merge after the CI builds green
i'll do a rebase and squash the commits |
I just added the change in the url |
yeah, so as I thought, the libargon2 is missing hence we used that url from before, so this time I am gonna make the changes, squash the commits, and force push. |
I am getting a lot of merge conflicts even though I followed the steps to a git rebase properly |
Thanks for giving it a try 👍 git fetch --all --prune
# squashing
git reset --soft HEAD~17
git commit --amend
# rebasing
git rebase upstream/develop # given the remote is called upstream I'll try to at least squash from the GitHub interface at least because it allows to |
|
okay tests passed, no more commits now. Just gotta squash the commits from before. |
@AndreMiras I tried the git commands you suggested the git log on my local repo gives the 17 commits even after running those commands |
No problem, thanks again for trying 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good thanks!
Using an interactive rebase to squash always works for me: git fetch --all
git rebase -i upstream/develop |
An alternative solution would be to add a separate recipe for |
@obfusk just give me a few days, I am in the middle of my semester exams, I will get back to this and clean it up as well as try and do this the right way. :) Thanks a lot for your help. |
np. There's no hurry :) Good luck!
The current version is squashed and merged. So it's already fine :)
There's nothing "wrong" now. Using a separate |
* testing argon2-cffi * Using CompiledComponentsPythonRecipe * argon2-cffi recipe
What have I done so far?
In my code I have been using the pycryptodome lib which already has a recipe in p4a, since it seemed to have the same dependencies as argon2-cffi, that being: cffi and setuptools, I decided to use it's code for argon2's recipe. After I did the fork I added the dependency in my spec file. It is visible that it got downloaded (but probably is not getting built properly) but always fails when I run the app. This is the error I got on a logcat after the build was done:
Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=reminiscor --bootstrap=sdl2 --requirements=python3,kivy,pycryptodome,argon2-cffi --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/kivy/Reminiscor/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21