无法在 python3 中构建 pycrypto 配方 - 工具链

Unable to build pycrypto recipe in python3 - toolchain

我正在尝试使用网站中的说明在 iOS 中打包一个简单的 Kivy 应用程序:

https://github.com/kivy/kivy-ios

我的应用程序非常简单,只有 1 行:

from firebase import firebase

可以使用 linux 在 android 中成功打包该应用程序。但是,我在将它打包到 iOS 时遇到了问题。我需要构建一个名为 pycrypto 的食谱,但它给了我以下错误。 python2 和 python3 我都试过了。我仍然遇到了同样的错误。看来 url link 已经死了 (https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz)

https://kivy.org/doc/stable/guide/packaging-ios.html
hcaos-iMac:kivy-ios hcao$ ./toolchain.py build pycrypto
[INFO    ] Building with 4 processes, where supported
[INFO    ] Want to build ['pycrypto']
[INFO    ] Loaded recipe pycrypto (depends of ['python', 'openssl'], optional are [])
[INFO    ] Loaded recipe python (depends of [u'python3'], optional are [])
[INFO    ] Loaded recipe openssl (depends of [], optional are [])
[INFO    ] Loaded recipe python3 (depends of ['hostpython3', 'libffi', 'openssl'], optional are [])
[INFO    ] Loaded recipe hostpython3 (depends of [], optional are ['openssl'])
[INFO    ] Loaded recipe libffi (depends of [], optional are [])
[INFO    ] Build order is ['libffi', 'openssl', 'hostpython3', u'python3', 'python', 'pycrypto']
[INFO    ] Recipe order is ['libffi', 'openssl', 'hostpython3', 'python3', 'pycrypto']
[INFO    ] Include dir added: {arch.arch}/ffi
[INFO    ] Include dir added: {arch.arch}/openssl
[INFO    ] Global: hostpython located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/python
[INFO    ] Global: hostpgen located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/pgen
[DEBUG   ] Cached result: Download libffi. Ignoring
[DEBUG   ] Cached result: Extract libffi. Ignoring
[DEBUG   ] Cached result: Build_all libffi. Ignoring
[DEBUG   ] Cached result: Download openssl. Ignoring
[DEBUG   ] Cached result: Extract openssl. Ignoring
[DEBUG   ] Cached result: Build_all openssl. Ignoring
[DEBUG   ] Cached result: Download hostpython3. Ignoring
[DEBUG   ] Cached result: Extract hostpython3. Ignoring
[DEBUG   ] Cached result: Build_all hostpython3. Ignoring
[DEBUG   ] Cached result: Download python3. Ignoring
[DEBUG   ] Cached result: Extract python3. Ignoring
[DEBUG   ] Cached result: Build_all python3. Ignoring
[INFO    ] Download pycrypto
[INFO    ] Downloading https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
Traceback (most recent call last):
  File "./toolchain.py", line 1569, in <module>
    ToolchainCL()
  File "./toolchain.py", line 1284, in __init__
    getattr(self, args.command)()
  File "./toolchain.py", line 1325, in build
    build_recipes(args.recipe, ctx)
  File "./toolchain.py", line 1161, in build_recipes
    recipe.execute()
  File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 726, in execute
    self.download()
  File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 84, in _cache_execution
    f(self, *args, **kwargs)
  File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 761, in download
    self.download_file(self.url.format(version=self.version), fn)
  File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 478, in download_file
    urlretrieve(url, filename, report_hook)
  File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1731, in retrieve
    fp = self.open(url, data)
  File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1703, in open
    raise_with_traceback(IOError('socket error', msg))
  File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1697, in open
    return getattr(self, name)(url)
  File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1907, in open_https
    return self._open_generic_http(self._https_connection, url, data)
  File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1856, in _open_generic_http
    http_conn.request("GET", selector, headers=headers)
  File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1083, in request
    self._send_request(method, url, body, headers)
  File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1121, in _send_request
    self.endheaders(body)
  File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1079, in endheaders
    self._send_output(message_body)
  File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 924, in _send_output
    self.send(msg)
  File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 860, in send
    self.connect()
  File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1221, in connect
    self.timeout, self.source_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection
    raise err
IOError: [Errno socket error] [Errno 61] Connection refused

答案可以在https://github.com/kivy/kivy-ios/issues/384找到 可以构建 Pycrypto,但它不会 运行 正确。解决方法是完全避免使用 firebase(需要 pycrypto)。使用 requests 和 json 代替简单的 get 和 post 方法。