From d175c8e8968cff1cc0d81e37ab91e2e6c06e8402 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 21 Aug 2021 21:09:54 +0100 Subject: [PATCH] restore netifaces recipe --- buildozer.spec.arm.ci | 2 +- buildozer.spec.arm64.ci | 2 +- buildozer.spec.sample | 2 +- buildozer.spec.vagrant | 2 +- recipes/netifaces/__init__.py | 32 +++++++++++++++++++++++++++ recipes/netifaces/socket-ioctls.patch | 29 ++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 recipes/netifaces/__init__.py create mode 100644 recipes/netifaces/socket-ioctls.patch diff --git a/buildozer.spec.arm.ci b/buildozer.spec.arm.ci index de3a374..aa666ed 100644 --- a/buildozer.spec.arm.ci +++ b/buildozer.spec.arm.ci @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.arm64.ci b/buildozer.spec.arm64.ci index 67b7b36..06ec30a 100644 --- a/buildozer.spec.arm64.ci +++ b/buildozer.spec.arm64.ci @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.sample b/buildozer.spec.sample index cb68653..4b0a69e 100644 --- a/buildozer.spec.sample +++ b/buildozer.spec.sample @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.vagrant b/buildozer.spec.vagrant index 05e651a..fd7ccb2 100644 --- a/buildozer.spec.vagrant +++ b/buildozer.spec.vagrant @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, netifaces, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/recipes/netifaces/__init__.py b/recipes/netifaces/__init__.py new file mode 100644 index 0000000..55b5d58 --- /dev/null +++ b/recipes/netifaces/__init__.py @@ -0,0 +1,32 @@ +import glob +from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe +from os.path import join +import os +import sh + + +class NetifacesRecipe(CompiledComponentsPythonRecipe): + version = '0.10.7' + url = 'https://files.pythonhosted.org/packages/81/39/4e9a026265ba944ddf1fea176dbb29e0fe50c43717ba4fcf3646d099fe38/netifaces-{version}.tar.gz' + depends = [('python2', 'python3crystax'), 'setuptools'] + call_hostpython_via_targetpython = False + patches = ['socket-ioctls.patch'] + + def get_recipe_env(self, arch): + env = super(NetifacesRecipe, self).get_recipe_env(arch) + + env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions' + + if self.ctx.ndk == 'crystax': + # only keeps major.minor (discards patch) + python_version = self.ctx.python_recipe.version[0:3] + ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version) + env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch)) + env['LDFLAGS'] += ' -lpython{}m'.format(python_version) + # until `pythonforandroid/archs.py` gets merged upstream: + # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6 + env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) + + return env + +recipe = NetifacesRecipe() diff --git a/recipes/netifaces/socket-ioctls.patch b/recipes/netifaces/socket-ioctls.patch new file mode 100644 index 0000000..4e6da70 --- /dev/null +++ b/recipes/netifaces/socket-ioctls.patch @@ -0,0 +1,29 @@ +--- a/netifaces.c 2018-09-25 21:26:48.238476102 +0100 ++++ b/netifaces.c 2018-09-25 21:55:14.201995669 +0100 +@@ -22,6 +22,10 @@ + obj = Py_InitModule3((name), (methods), (doc)); + #endif + ++#ifndef HAVE_SOCKET_IOCTLS ++#define HAVE_SOCKET_IOCTLS 1 ++#endif ++ + #ifndef WIN32 + + # include +@@ -178,12 +182,12 @@ + # include + # endif /* HAVE_GETIFADDRS */ + +-# if !HAVE_GETIFADDRS && (!HAVE_SOCKET_IOCTLS || !HAVE_SIOCGIFCONF) ++//# if !HAVE_GETIFADDRS && (!HAVE_SOCKET_IOCTLS || !HAVE_SIOCGIFCONF) + /* If the platform doesn't define, what we need, barf. If you're seeing this, + it means you need to write suitable code to retrieve interface information + on your system. */ +-# error You need to add code for your platform. +-# endif ++//# error You need to add code for your platform. ++//# endif + + #else /* defined(WIN32) */ +