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

[WIP] Netifaces #239

Closed
wants to merge 2 commits into from
Closed

[WIP] Netifaces #239

wants to merge 2 commits into from

Conversation

cbenhagen
Copy link
Contributor

@rnixx and @Zen-CODE what exactly were the problems solved by 7cca790? With this commit I was unable to install netifaces. I had some setuptools troubles too which I solved with this. I am not quite happy with that solution either. Any suggestions?

@akshayaurora
Copy link
Member

@cbenhagen @rnixx same issues for pil, I had to comment out the changes to get pil installation to work again.2

@rnixx
Copy link
Member

rnixx commented Dec 28, 2016

@cbenhagen Without unpacking setuptools and removing the pth linking, I got errors when trying to install other recipes via hostpython depending on setuptools, like https://github.com/rnixx/kivy-ios/blob/twisted_recipe/recipes/txaio/__init__.py

For some reason the pth file was not resolved properly. On the other hand I am wondering why an extracted setuptools causes problems in your case. Did you run host_setuptools recipe on an existing hostpython or a fresh installation?

@cbenhagen
Copy link
Contributor Author

cbenhagen commented Jan 1, 2017

Is this the error you get?

File "/Users/ben/Projects/couch-kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1287, in install_site_py
    with io.open(sitepy) as strm:
TypeError: bad argument type for built-in operation

Full log here: https://gist.github.com/cbenhagen/d2d5024716f26fd8e7101dec47bb7ac4

@cbenhagen
Copy link
Contributor Author

I ran this on an existing hostpython. But this should not matter at all and if it does we should open an issue for this.

@cbenhagen
Copy link
Contributor Author

Running your six recipe with subprocess works however:

from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
import subprocess


class SixRecipe(PythonRecipe):
    version = "1.10.0"
    url = (
        "https://pypi.python.org/packages/b3/b2/"
        "238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/"
        "six-{version}.tar.gz"
    )
    depends = ["python"]

    def install(self):
        arch = list(self.filtered_archs)[0]
        build_dir = self.get_build_dir(arch.arch)
        os.chdir(build_dir)
        hostpython = sh.Command(self.ctx.hostpython)
        build_env = arch.get_env()
        dest_dir = join(self.ctx.dist_dir, "root", "python")
        pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
        build_env['PYTHONPATH'] = pythonpath

        # args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
        # shprint(*args, _env=build_env)

        env = ' '.join(['{}="{}"'.format(k, v) for k, v in build_env.iteritems()])
        cmd = ' '.join([env, self.ctx.hostpython, "setup.py", "install", "--prefix", dest_dir])
        out = subprocess.check_output(cmd, shell=True)
        print(out)

recipe = SixRecipe()

I wonder what the usage of the sh library has to do with it.

@rnixx
Copy link
Member

rnixx commented Jan 2, 2017

@cbenhagen

Is this the error you get?
...
TypeError: bad argument type for built-in operation

Yes. I stepped into the code with pdb and sitepy was None. Totally weird. https://github.com/pypa/setuptools/blob/master/setuptools/command/easy_install.py#L1280 sitepy is a path and also checked whether it exists https://github.com/pypa/setuptools/blob/master/setuptools/command/easy_install.py#L1285, but suddenly None... !?

Interesting that the use of sh lib seems to cause the problem. What's the benefit over using subprocess directly? Maybe it should be dropped?

@cbenhagen
Copy link
Contributor Author

Setting sitepy to None would raise TypeError: invalid file: None. Weird indeed.

sh is just a more pythonic way to use shell commands. While it could just be dropped I would prefer to understand what is going on.

@AndreMiras AndreMiras closed this in d61008a May 7, 2020
AndreMiras added a commit that referenced this pull request May 7, 2020
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.

None yet

3 participants