diff --git a/kivy_ios.egg-info/PKG-INFO b/kivy_ios.egg-info/PKG-INFO new file mode 100644 index 0000000..58b2187 --- /dev/null +++ b/kivy_ios.egg-info/PKG-INFO @@ -0,0 +1,339 @@ +Metadata-Version: 2.1 +Name: kivy-ios +Version: 1.1.2.dev0 +Summary: Kivy for iOS +Home-page: https://github.com/kivy/kivy-ios +Author: The Kivy team +Author-email: kivy-dev@googlegroups.com +License: UNKNOWN +Description: # Kivy for iOS + + [![kivy-ios](https://github.com/kivy/kivy-ios/workflows/kivy-ios/badge.svg)](https://github.com/kivy/kivy-ios/actions?query=workflow%3Akivy-ios) + [![PyPI version](https://badge.fury.io/py/kivy-ios.svg)](https://badge.fury.io/py/kivy-ios) + [![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers) + [![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors) + + This toolchain is designed to compile the necessary libraries for iOS to run + your application and manage the creation of the Xcode project. + + We do not provide any binary distributions of this toolchain. + You do need to compile it at least once before creating your Xcode project. + + The toolchain supports: + + - iPhone Simulator (x86_64) + - iPhone / iOS (armv7 and arm64) + + These recipes are not ported to the new toolchain yet: + + - lxml + + + ## Installation & requirements + + Before we start, we strongly advise to use a Python virtual environment to install Python packages. + + python3 -m venv venv + . venv/bin/activate + + Install [Kivy for iOS from PyPI](https://pypi.org/project/kivy-ios) with pip like any Python package. + + pip3 install kivy-ios + + Additionally you would need few system dependencies and configuration. + + - Xcode 10 or above, with an iOS SDK and command line tools installed: + + xcode-select --install + + - Using brew, you can install the following dependencies: + + brew install autoconf automake libtool pkg-config + brew link libtool + + ## Using the toolchain + + Any Python extensions or C/C++ library must be compiled: you need to have what + we call a `recipe` to compile it. For example, Python, libffi, SDL2, SDL_image, + freetype... all the dependencies, compilation and packaging instructions are + contained in a `recipe`. + + You can list the available recipes and their versions with: + + $ toolchain recipes + audiostream master + click 7.1.2 + cymunk master + ffmpeg 2.6.3 + ffpyplayer v3.2 + flask 1.1.2 + freetype 2.5.5 + hostlibffi 3.2.1 + hostpython3 3.7.1 + ios master + itsdangerous 1.1.0 + jinja2 2.11.2 + kivy 1.10.1 + libffi 3.2.1 + libjpeg v9a + libpng 1.6.26 + markupsafe 1.1.1 + moodstocks 4.1.5 + numpy 1.16.4 + openssl 1.0.2k + photolibrary master + pillow 6.1.0 + plyer master + pycrypto 2.6.1 + pykka 1.2.1 + pyobjus master + python3 3.7.1 + pyyaml 3.11 + sdl2 2.0.8 + sdl2_image 2.0.0 + sdl2_mixer 2.0.0 + sdl2_ttf 2.0.12 + werkzeug 1.0.1 + + Then, start the compilation with: + + $ toolchain build python3 kivy + + You can build recipes at the same time by adding them as parameters: + + $ toolchain build python3 openssl kivy + + Recipe builds can be removed via the clean command e.g.: + + $ toolchain clean openssl + + You can install package that don't require compilation with pip:: + + $ toolchain pip install plyer + + The Kivy recipe depends on several others, like the sdl\* and python recipes. + These may in turn depend on others e.g. sdl2_ttf depends on freetype, etc. + You can think of it as follows: the kivy recipe will compile everything + necessary for a minimal working version of Kivy. + + Don't grab a coffee, just do diner. Compiling all the libraries for the first + time, 3x over (remember, 3 archs, x86_64, armv7, arm64) will take time. + + For a complete list of available commands, type: + + $ toolchain + + ## Create the Xcode project + + The `toolchain.py` can create the initial Xcode project for you:: + + $ toolchain create <app_directory> + $ toolchain create Touchtracer ~/code/kivy/examples/demo/touchtracer + + Your app directory must contain a main.py. A directory named `<title>-ios` + will be created, with an Xcode project in it. + You can open the Xcode project using:: + + $ open touchtracer-ios/touchtracer.xcodeproj + + Then click on `Play`, and enjoy. + + > *Did you know ?* + > + > Everytime you press `Play`, your application directory will be synced to + > the `<title>-ios/YourApp` directory. Don't make changes in the -ios + > directory directly. + + + ## Configuring your App + + You can configure and customize your app in various ways: + + - Set the icon and launch images in XCode. Note that XCode requires that you + specify these assests per device or/and iOS version. + + - When you first build your XCode project, a 'main.m' file is created in your + XCode project folder. This file configures your environment variables and + controls your application startup. You can edit this file to customize your + launch environment. + + - Kivy uses SDL, and as soon as the application starts the SDL main, the launch + image will disappear. To prevent that, you need to have 2 files named + `Default.png` and `Default-Landscape.png`, and put them + in the `Resources` folder in Xcode (not in your application folder) + + > *Did you know ?* + > + > If you wish to restrict your apps orientation, you should do this via + > the 'export_orientation' function in 'main.m'. The XCode orientation + > settings should be set to support all. + + + ## Using recipes + + Recipes are used to install and compile any libraries you may need to use. These + recipes follow the same format as those used by the + [Python-for-Android](https://github.com/kivy/python-for-android) sister project. + Please refer to the + [recipe documentation](https://python-for-android.readthedocs.io/en/latest/recipes/) + there for more detail. + + + ## Reducing the application size + + If you would like to reduce the size of your distributed app, there are a few + things you can do to achieve this: + + - Minimize the `build/pythonX/lib/pythonXX.zip`: this contains all the python + modules. You can edit the zip file and remove all the files you'll not use + (reduce encodings, remove xml, email...) + + - Go to the settings `panel` > `build`, search for `"strip"` options, and + triple-check that they are all set to `NO`. Stripping does not work with + Python dynamic modules and will remove needed symbols. + + - By default, the iOS package compiles binaries for all processor + architectures, namely x86_64, armv7 and arm64 as per the guidelines from + Apple. You can reduce the size of your ipa significantly by removing the + x86_64 architecture as they are used only for the emulator. + + The procedure is to first compile/build all the host recipes as is: + + toolchain build hostpython3 + + Then build all the rest of the recipes using --arch=armv7 --arch=arm64 + arguments as follows: + + toolchain build python3 kivy --arch=armv7 --arch=arm64 + + Note that these packages will not run in the iOS emulators, so use them + only for deployment. + + ## Usage + + ``` + toolchain <command> [<args>] + + Available commands: + build Build a recipe (compile a library for the required target + architecture) + clean Clean the build of the specified recipe + distclean Clean the build and the result + recipes List all the available recipes + status List all the recipes and their build status + + Xcode: + create Create a new xcode project + update Update an existing xcode project (frameworks, libraries..) + launchimage Create Launch images for your xcode project + icon Create Icons for your xcode project + pip Install a pip dependency into the distribution + pip3 Install a pip dependency into the python 3 distribution + ``` + + ## Development + + Alternatively, it's also possible to clone the repository and use all the + described commands in the above sections. + Clone and install it to your local virtual environment: + + git clone https://github.com/kivy/kivy-ios.git + cd kivy-ios/ + python3 -m venv venv + . venv/bin/activate + pip install -e . + + Then use the `toolchain.py` script: + + python toolchain.py --help + + + ## FAQ + + ### Fatal error: "stdio.h" file not found + + You need to install the Command line tools: `xcode-select --install` + + ### You must build with bitcode disabled (Xcode setting ENABLE_BITCODE should be No). + + We don't support bitcode. You need to go to the project setting, and disable bitcode. + + ### You don't have permissions to run + + It is due to invalid archs, search for them and check it. Maybe you + targetted a simulator but have only armv7/arm64. Maybe you want to target + your iPad but it as only x86_64. + + ### Why does the python multiprocess/subprocess module not work? + + The iOS application model does not currently support multi-processing in a + cross-platform compatible way. The application design focuses on minimizing + processor usage (to minimize power consumption) and promotes an + [alternative concurrency model](https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html). + + If you need to make use of multiple processes, you should consider using + [PyObjus](https://github.com/kivy/pyobjus) to leverage native iOS + functionals for this. + + ## Support + + If you need assistance, you can ask for help on our mailing list: + + * User Group : https://groups.google.com/group/kivy-users + * Email : kivy-users@googlegroups.com + + We also have a Discord channel: + + * Server : https://chat.kivy.org + * Channel : #support + + + ## Contributing + + We love pull requests and discussing novel ideas. Check out our + [contribution guide](http://kivy.org/docs/contribute.html) and + feel free to improve Kivy for iOS. + + The following mailing list and IRC channel are used exclusively for + discussions about developing the Kivy framework and its sister projects: + + * Dev Group : https://groups.google.com/group/kivy-dev + * Email : kivy-dev@googlegroups.com + + Discord channel: + + * Server : https://chat.kivy.org + * Channel : #dev + + ## License + + Kivy for iOS is released under the terms of the MIT License. Please refer to the + LICENSE file. + + + ## Backers + + Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/kivy#backer)] + + <a href="https://opencollective.com/kivy#backers" target="_blank"><img src="https://opencollective.com/kivy/backers.svg?width=890"></a> + + + ## Sponsors + + Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/kivy#sponsor)] + + <a href="https://opencollective.com/kivy/sponsor/0/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/0/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/1/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/1/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/2/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/2/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/3/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/3/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/4/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/4/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/5/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/5/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/6/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/6/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/7/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/7/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/8/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/8/avatar.svg"></a> + <a href="https://opencollective.com/kivy/sponsor/9/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/9/avatar.svg"></a> + + +Platform: UNKNOWN +Requires-Python: >=3.6.0 +Description-Content-Type: text/markdown diff --git a/kivy_ios.egg-info/SOURCES.txt b/kivy_ios.egg-info/SOURCES.txt new file mode 100644 index 0000000..9f4dfb6 --- /dev/null +++ b/kivy_ios.egg-info/SOURCES.txt @@ -0,0 +1,256 @@ +README.md +setup.py +kivy_ios/__init__.py +kivy_ios/context_managers.py +kivy_ios/toolchain.py +kivy_ios.egg-info/PKG-INFO +kivy_ios.egg-info/SOURCES.txt +kivy_ios.egg-info/dependency_links.txt +kivy_ios.egg-info/entry_points.txt +kivy_ios.egg-info/requires.txt +kivy_ios.egg-info/top_level.txt +kivy_ios/__pycache__/__init__.cpython-37.pyc +kivy_ios/__pycache__/__init__.cpython-38.pyc +kivy_ios/__pycache__/context_managers.cpython-37.pyc +kivy_ios/__pycache__/context_managers.cpython-38.pyc +kivy_ios/__pycache__/toolchain.cpython-37.pyc +kivy_ios/__pycache__/toolchain.cpython-38.pyc +kivy_ios/recipes/__init__.py +kivy_ios/recipes/hostpython.py +kivy_ios/recipes/python.py +kivy_ios/recipes/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/__pycache__/python.cpython-37.pyc +kivy_ios/recipes/__pycache__/python.cpython-38.pyc +kivy_ios/recipes/aiohttp/__init__.py +kivy_ios/recipes/aioupnp/__init__.py +kivy_ios/recipes/appdirs/__init__.py +kivy_ios/recipes/appdirs/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/asn1crypto/__init__.py +kivy_ios/recipes/asn1crypto/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/async-timeout/__init__.py +kivy_ios/recipes/attrs/__init__.py +kivy_ios/recipes/attrs/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/audiostream/__init__.py +kivy_ios/recipes/audiostream/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/base58/__init__.py +kivy_ios/recipes/base58/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/cffi/__init__.py +kivy_ios/recipes/cffi/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/chardet/__init__.py +kivy_ios/recipes/click/__init__.py +kivy_ios/recipes/click/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/coincurve/__init__.py +kivy_ios/recipes/coincurve/cross_compile.patch +kivy_ios/recipes/coincurve/drop_setup_requires.patch +kivy_ios/recipes/coincurve/find_lib.patch +kivy_ios/recipes/coincurve/no-download.patch +kivy_ios/recipes/coincurve/setup.py.patch +kivy_ios/recipes/colorama/__init__.py +kivy_ios/recipes/colorama/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/cryptography/__init__.py +kivy_ios/recipes/cryptography/getentropy.patch +kivy_ios/recipes/cryptography/osrandom.patch +kivy_ios/recipes/cryptography/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/curly/__init__.py +kivy_ios/recipes/curly/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/cymunk/__init__.py +kivy_ios/recipes/cymunk/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/defusedxml/__init__.py +kivy_ios/recipes/docopt/__init__.py +kivy_ios/recipes/docopt/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/ecdsa/__init__.py +kivy_ios/recipes/ecdsa/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/ffmpeg/__init__.py +kivy_ios/recipes/ffmpeg/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/ffpyplayer/__init__.py +kivy_ios/recipes/ffpyplayer/misc-visibility.patch +kivy_ios/recipes/ffpyplayer/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/flask/__init__.py +kivy_ios/recipes/flask/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/freetype/__init__.py +kivy_ios/recipes/freetype/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/freetype/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/hachoir/__init__.py +kivy_ios/recipes/host_cffi/__init__.py +kivy_ios/recipes/host_setuptools/__init__.py +kivy_ios/recipes/host_setuptools/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/host_setuptools/setuptools/README.rst +kivy_ios/recipes/host_setuptools3/__init__.py +kivy_ios/recipes/host_setuptools3/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/host_setuptools3/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/host_setuptools3/setuptools/README.rst +kivy_ios/recipes/hostlibffi/__init__.py +kivy_ios/recipes/hostlibffi/ffi-3.0.13-sysv.S.patch +kivy_ios/recipes/hostlibffi/fix-win32-unreferenced-symbol.patch +kivy_ios/recipes/hostlibffi/generate-darwin-source-and-headers-python3-items.patch +kivy_ios/recipes/hostlibffi/libffi-xcode10.patch +kivy_ios/recipes/hostlibffi/public_include.patch +kivy_ios/recipes/hostlibffi/staticlib.patch +kivy_ios/recipes/hostlibffi/staticlib2.patch +kivy_ios/recipes/hostlibffi/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/hostlibffi/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/hostopenssl/__init__.py +kivy_ios/recipes/hostopenssl/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/hostopenssl/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/hostpython3/ModulesSetup +kivy_ios/recipes/hostpython3/__init__.py +kivy_ios/recipes/hostpython3/pyconfig_detection.patch +kivy_ios/recipes/hostpython3/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/hostpython3/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/idna/__init__.py +kivy_ios/recipes/idna/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/ios/__init__.py +kivy_ios/recipes/ios/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/ios/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/ios/src/ios.pyx +kivy_ios/recipes/ios/src/ios_browser.m +kivy_ios/recipes/ios/src/ios_filechooser.m +kivy_ios/recipes/ios/src/ios_mail.m +kivy_ios/recipes/ios/src/ios_utils.m +kivy_ios/recipes/ios/src/ios_wrapper.h +kivy_ios/recipes/ios/src/setup.py +kivy_ios/recipes/ipaddress/__init__.py +kivy_ios/recipes/ipaddress/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/itsdangerous/__init__.py +kivy_ios/recipes/itsdangerous/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/jinja2/__init__.py +kivy_ios/recipes/jinja2/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/jsonschema/__init__.py +kivy_ios/recipes/jsonschema/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/keyring/__init__.py +kivy_ios/recipes/keyring/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/kivent_core/__init__.py +kivy_ios/recipes/kivent_core/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/kivy/__init__.py +kivy_ios/recipes/kivy/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/kivy/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/lbry/__init__.py +kivy_ios/recipes/lbry/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/libcurl/__init__.py +kivy_ios/recipes/libcurl/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/libffi/__init__.py +kivy_ios/recipes/libffi/ffi-3.0.13-sysv.S.patch +kivy_ios/recipes/libffi/fix-win32-unreferenced-symbol.patch +kivy_ios/recipes/libffi/generate-darwin-source-and-headers-python3-items.patch +kivy_ios/recipes/libffi/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/libffi/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/libjpeg/__init__.py +kivy_ios/recipes/libjpeg/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/libpng/__init__.py +kivy_ios/recipes/libpng/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/libsecp256k1/__init__.py +kivy_ios/recipes/libzbar/__init__.py +kivy_ios/recipes/libzbar/werror.patch +kivy_ios/recipes/libzbar/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/markupsafe/__init__.py +kivy_ios/recipes/markupsafe/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/mock/__init__.py +kivy_ios/recipes/msgpack/__init__.py +kivy_ios/recipes/multidict/__init__.py +kivy_ios/recipes/netifaces/__init__.py +kivy_ios/recipes/netifaces/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/numpy/__init__.py +kivy_ios/recipes/numpy/numpy-1.16.4.patch +kivy_ios/recipes/numpy/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/openssl/__init__.py +kivy_ios/recipes/openssl/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/openssl/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/pbkdf2/__init__.py +kivy_ios/recipes/pbkdf2/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/photolibrary/__init__.py +kivy_ios/recipes/photolibrary/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pillow/__init__.py +kivy_ios/recipes/pillow/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/plyer/__init__.py +kivy_ios/recipes/plyer/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/prometheus_client/__init__.py +kivy_ios/recipes/protobuf/__init__.py +kivy_ios/recipes/protobuf/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pyasn1/__init__.py +kivy_ios/recipes/pyasn1-modules/__init__.py +kivy_ios/recipes/pyasn1-modules/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pyasn1/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pycparser/__init__.py +kivy_ios/recipes/pycrypto/__init__.py +kivy_ios/recipes/pycrypto/hash_SHA2_template.c.patch +kivy_ios/recipes/pycrypto/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pykka/__init__.py +kivy_ios/recipes/pykka/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pylru/__init__.py +kivy_ios/recipes/pyobjus/__init__.py +kivy_ios/recipes/pyobjus/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/pyobjus/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/python3/ModulesSetup +kivy_ios/recipes/python3/ModulesSetup.mobile +kivy_ios/recipes/python3/__init__.py +kivy_ios/recipes/python3/config.sub.patch +kivy_ios/recipes/python3/configure.patch +kivy_ios/recipes/python3/ctypes_duplicate.patch +kivy_ios/recipes/python3/disable_explicit_blake2.patch +kivy_ios/recipes/python3/dynload_shlib.patch +kivy_ios/recipes/python3/posixmodule.patch +kivy_ios/recipes/python3/pyconfig_detection.patch +kivy_ios/recipes/python3/random.patch +kivy_ios/recipes/python3/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/python3/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/python3/mock_modules/_sqlite3/__init__.py +kivy_ios/recipes/python3/mock_modules/_sqlite3/_sqlite3.cpython-38-darwin.so +kivy_ios/recipes/pyyaml/__init__.py +kivy_ios/recipes/pyyaml/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/sdl2/__init__.py +kivy_ios/recipes/sdl2/uikit-transparent.patch +kivy_ios/recipes/sdl2/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/sdl2/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/sdl2_image/__init__.py +kivy_ios/recipes/sdl2_image/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/sdl2_image/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/sdl2_mixer/__init__.py +kivy_ios/recipes/sdl2_mixer/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/sdl2_mixer/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/sdl2_ttf/__init__.py +kivy_ios/recipes/sdl2_ttf/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/sdl2_ttf/__pycache__/__init__.cpython-38.pyc +kivy_ios/recipes/setuptools/__init__.py +kivy_ios/recipes/setuptools/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/six/__init__.py +kivy_ios/recipes/six/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/werkzeug/__init__.py +kivy_ios/recipes/werkzeug/__pycache__/__init__.cpython-37.pyc +kivy_ios/recipes/yarl/__init__.py +kivy_ios/recipes/zbarlight/__init__.py +kivy_ios/recipes/zbarlight/zbarlight_1_2.patch +kivy_ios/recipes/zbarlight/__pycache__/__init__.cpython-37.pyc +kivy_ios/tools/__init__.py +kivy_ios/tools/biglink +kivy_ios/tools/cythonize.py +kivy_ios/tools/liblink +kivy_ios/tools/external/__init__.py +kivy_ios/tools/external/xcassets.py +kivy_ios/tools/templates/cookiecutter.json +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/bridge.h +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/bridge.m +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/icon.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/main.m +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}-Info.plist +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-568h@2x.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-667h@2x.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-763h@3x.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-Landscape.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-Landscape@2x.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-Portrait.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-Portrait@2x~ipad.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default-Portrait@3x~ipad.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default@2x.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/LaunchImages/Default@3x.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/README.txt +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/android.txt +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/pictures.kv +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/shadow32.png +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/images/5509213687_ffd18df0b9_b.jpg +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/images/5552597274_de8b3fb5d2_b.jpg +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/YourApp/images/faust_github.jpg +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.xcworkspace/contents.xcworkspacedata +kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}/Images.xcassets/AppIcon.appiconset/Contents.json \ No newline at end of file diff --git a/kivy_ios.egg-info/dependency_links.txt b/kivy_ios.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/kivy_ios.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/kivy_ios.egg-info/entry_points.txt b/kivy_ios.egg-info/entry_points.txt new file mode 100644 index 0000000..585f9a8 --- /dev/null +++ b/kivy_ios.egg-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +toolchain = kivy_ios.toolchain:main + diff --git a/kivy_ios.egg-info/requires.txt b/kivy_ios.egg-info/requires.txt new file mode 100644 index 0000000..389b6d1 --- /dev/null +++ b/kivy_ios.egg-info/requires.txt @@ -0,0 +1,5 @@ +cookiecutter +pbxproj +Pillow +requests +sh diff --git a/kivy_ios.egg-info/top_level.txt b/kivy_ios.egg-info/top_level.txt new file mode 100644 index 0000000..dfe0ba7 --- /dev/null +++ b/kivy_ios.egg-info/top_level.txt @@ -0,0 +1 @@ +kivy_ios diff --git a/kivy_ios/recipes/aiohttp/__init__.py b/kivy_ios/recipes/aiohttp/__init__.py new file mode 100644 index 0000000..ed20330 --- /dev/null +++ b/kivy_ios/recipes/aiohttp/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import CythonRecipe, shprint +from os.path import join + + +class AioHttpRecipe(CythonRecipe): + version = "3.5.4" + url = "https://pypi.python.org/packages/source/a/aiohttp/aiohttp-{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", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = AioHttpRecipe() diff --git a/kivy_ios/recipes/aioupnp/__init__.py b/kivy_ios/recipes/aioupnp/__init__.py new file mode 100644 index 0000000..2507a6b --- /dev/null +++ b/kivy_ios/recipes/aioupnp/__init__.py @@ -0,0 +1,29 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import CythonRecipe, shprint +from os.path import join + +class AioupnpRecipe(CythonRecipe): + version = "0.0.17" + url = "https://pypi.python.org/packages/source/a/aioupnp/aioupnp-{version}.tar.gz" + depends = ["python", "defusedxml"] + + def prebuild_arch(self, arch): + if self.has_marker("patched"): + return + self.apply_patch("exclude_netifaces.patch") + self.apply_patch("none_netifaces.patch") + self.set_marker("patched") + + 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", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = AioupnpRecipe() diff --git a/kivy_ios/recipes/aioupnp/exclude_netifaces.patch b/kivy_ios/recipes/aioupnp/exclude_netifaces.patch new file mode 100644 index 0000000..649a015 --- /dev/null +++ b/kivy_ios/recipes/aioupnp/exclude_netifaces.patch @@ -0,0 +1,10 @@ +--- a/setup.py 2020-09-28 10:20:48.000000000 +0100 ++++ b/setup.py 2020-09-28 10:21:12.000000000 +0100 +@@ -36,7 +36,6 @@ + packages=find_packages(exclude=('tests',)), + entry_points={'console_scripts': console_scripts}, + install_requires=[ +- 'netifaces', + 'defusedxml' + ] + ) diff --git a/kivy_ios/recipes/aioupnp/none_netifaces.patch b/kivy_ios/recipes/aioupnp/none_netifaces.patch new file mode 100644 index 0000000..fc32878 --- /dev/null +++ b/kivy_ios/recipes/aioupnp/none_netifaces.patch @@ -0,0 +1,16 @@ +--- a/aioupnp/interfaces.py 2020-09-28 10:23:40.000000000 +0100 ++++ b/aioupnp/interfaces.py 2020-09-28 10:23:56.000000000 +0100 +@@ -1,12 +1,11 @@ + import socket + from collections import OrderedDict + import typing +-import netifaces + from aioupnp.fault import UPnPError + + + def get_netifaces(): +- return netifaces ++ return None + + + def ifaddresses(iface: str) -> typing.Dict[int, typing.List[typing.Dict[str, str]]]: diff --git a/kivy_ios/recipes/appdirs/__init__.py b/kivy_ios/recipes/appdirs/__init__.py index 12ff802..c4dfc6c 100644 --- a/kivy_ios/recipes/appdirs/__init__.py +++ b/kivy_ios/recipes/appdirs/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class AppdirsRecipe(PythonRecipe): version = "1.4.3" url = "https://pypi.python.org/packages/source/a/appdirs/appdirs-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class AppdirsRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = AppdirsRecipe() diff --git a/kivy_ios/recipes/argparse/__init__.py b/kivy_ios/recipes/argparse/__init__.py deleted file mode 100644 index ce0cefd..0000000 --- a/kivy_ios/recipes/argparse/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class ArgparseRecipe(PythonRecipe): - version = "1.2.1" - url = "https://pypi.python.org/packages/source/a/argparse/argparse-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = ArgparseRecipe() diff --git a/kivy_ios/recipes/asn1crypto/__init__.py b/kivy_ios/recipes/asn1crypto/__init__.py index e939160..f04037e 100644 --- a/kivy_ios/recipes/asn1crypto/__init__.py +++ b/kivy_ios/recipes/asn1crypto/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class Asn1CryptoRecipe(PythonRecipe): version = "0.24.0" url = "https://pypi.python.org/packages/source/a/asn1crypto/asn1crypto-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class Asn1CryptoRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = Asn1CryptoRecipe() diff --git a/kivy_ios/recipes/async-timeout/__init__.py b/kivy_ios/recipes/async-timeout/__init__.py new file mode 100644 index 0000000..64deae4 --- /dev/null +++ b/kivy_ios/recipes/async-timeout/__init__.py @@ -0,0 +1,22 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class AsyncTimeoutRecipe(PythonRecipe): + version = "3.0.1" + url = "https://pypi.python.org/packages/source/a/async-timeout/async-timeout-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = AsyncTimeoutRecipe() diff --git a/kivy_ios/recipes/attrs/__init__.py b/kivy_ios/recipes/attrs/__init__.py index 57a0687..69fd0eb 100644 --- a/kivy_ios/recipes/attrs/__init__.py +++ b/kivy_ios/recipes/attrs/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class AttrsRecipe(PythonRecipe): version = "18.1.0" url = "https://pypi.python.org/packages/source/a/attrs/attrs-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class AttrsRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = AttrsRecipe() diff --git a/kivy_ios/recipes/base58/__init__.py b/kivy_ios/recipes/base58/__init__.py index f8fbc4f..f223144 100644 --- a/kivy_ios/recipes/base58/__init__.py +++ b/kivy_ios/recipes/base58/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class Base58Recipe(PythonRecipe): - version = "0.2.2" + version = "1.0.0" url = "https://pypi.python.org/packages/source/b/base58/base58-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class Base58Recipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = Base58Recipe() diff --git a/kivy_ios/recipes/cffi/__init__.py b/kivy_ios/recipes/cffi/__init__.py index 480a433..44d86ce 100644 --- a/kivy_ios/recipes/cffi/__init__.py +++ b/kivy_ios/recipes/cffi/__init__.py @@ -1,4 +1,4 @@ -from toolchain import CythonRecipe, shprint +from kivy_ios.toolchain import CythonRecipe, shprint from os.path import join import os import sh @@ -6,10 +6,10 @@ import sh class CffiRecipe(CythonRecipe): name = "cffi" - version = "1.11.5" + version = "1.14.3" url = "https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz" library = "libcffi.a" - depends = ["host_cffi", "libffi", "setuptools", "pycparser"] + depends = ["host_cffi", "libffi", "pycparser"] cythonize = False def get_recipe_env(self, arch): @@ -26,23 +26,26 @@ class CffiRecipe(CythonRecipe): os.chdir(build_dir) # manually create expected directory in build directory - scripts_dir = join("build", "scripts-2.7") + scripts_dir = join("build", "scripts-3.8") if not os.path.exists(scripts_dir): os.makedirs(scripts_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "build_ext", _env=build_env) shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) # hack: copy _cffi_backend.so from hostpython - so_file = "_cffi_backend.so" - egg_name = "cffi-1.11.5-py2.7-macosx-10.4-x86_64.egg" # harded - needs to change - dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7", "site-packages", egg_name) - src_dir = join(self.ctx.dist_dir, "hostpython", "lib", "python2.7", "site-packages", egg_name) + so_file = "_cffi_backend.cpython-38-darwin.so" + egg_name = "cffi-1.14.3-py3.8-macosx-10.15-x86_64.egg" # harded - needs to change + dest_dir = join(self.ctx.dist_dir, "root", "python3", "lib", "python3.8", "site-packages", egg_name) + dest_dir_main = join(self.ctx.dist_dir, "root", "python3", "lib", "python3.8", "site-packages") + + src_dir = join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8", "site-packages", egg_name) sh.cp(join(src_dir, so_file), join(dest_dir, so_file)) + sh.cp(join(src_dir, so_file), join(dest_dir_main, so_file)) recipe = CffiRecipe() diff --git a/kivy_ios/recipes/chardet/__init__.py b/kivy_ios/recipes/chardet/__init__.py new file mode 100644 index 0000000..50f9982 --- /dev/null +++ b/kivy_ios/recipes/chardet/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class ChardetRecipe(PythonRecipe): + version = "3.0.4" + url = "https://pypi.python.org/packages/source/c/chardet/chardet-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = ChardetRecipe() diff --git a/kivy_ios/recipes/coincurve/__init__.py b/kivy_ios/recipes/coincurve/__init__.py new file mode 100644 index 0000000..a18fb4e --- /dev/null +++ b/kivy_ios/recipes/coincurve/__init__.py @@ -0,0 +1,76 @@ +import sh +import os +from os.path import join + +from kivy_ios.toolchain import CythonRecipe, Recipe, shprint +from kivy_ios.context_managers import cd + + +class CoincurveRecipe(CythonRecipe): + version = "7.1.0" + url = "https://github.com/ofek/coincurve/archive/{version}.tar.gz" + depends = ["python3", "libffi", "cffi", "pycparser", "libsecp256k1"] + library = 'libcoincurve.a' + pre_build_ext = True + include_per_arch = True + + def dest_dir(self): + return join(self.ctx.dist_dir, "root", "python3") + + def prebuild_arch(self, arch): + # common to all archs + if self.has_marker("patched"): + return + self.apply_patch("cross_compile.patch") + self.apply_patch("drop_setup_requires.patch") + self.apply_patch("find_lib.patch") + self.apply_patch("no-download.patch") + self.apply_patch("setup.py.patch") + self.set_marker("patched") + + def get_recipe_env(self, arch): + env = arch.get_env() + # sets linker to use the correct gcc (cross compiler) + env['TOOLCHAIN_PREFIX'] = arch.triple + env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl' + libsecp256k1 = self.get_recipe('libsecp256k1', self.ctx) + libsecp256k1_dir = libsecp256k1.get_build_dir(arch.arch) + env['LDFLAGS'] += ' -L{}'.format(os.path.join(libsecp256k1_dir, '.libs')) + env['CFLAGS'] += ' -I' + os.path.join(libsecp256k1_dir, 'include') + + target_python = Recipe.get_recipe('python3', self.ctx).get_build_dir(arch.arch) + env['LDFLAGS'] += ' -L' + target_python + + print(env['LDFLAGS']) + + python_version = '3.8' + env["PYTHONPATH"] = join(self.dest_dir(), "lib", "python3.8", "site-packages") + env['PYTHON_ROOT'] = join(self.ctx.dist_dir, "root", "python3") + env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python{}'.format(python_version) + env['LDFLAGS'] += " -lpython{}".format(python_version) + env['LDFLAGS'] += " -lsecp256k1 -lssl -lcrypto -lffi -lz" + return env + + 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", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + def postbuild_arch(self, arch): + py_arch = arch.arch + if py_arch == "arm64": + py_arch = "x86_64" + build_dir = self.get_build_dir(arch.arch) + build_env = self.get_recipe_env(arch) + tmp_folder = 'build/temp.macosx-10.15-{}-3.8/build/temp.macosx-10.15-{}-3.8'.format(py_arch, py_arch) + shprint(sh.Command(build_env['AR']), + "-q", + "{}/{}".format(self.build_dir, self.library), + "{}/{}/_libsecp256k1.o".format(self.build_dir, tmp_folder)) + +recipe = CoincurveRecipe() diff --git a/kivy_ios/recipes/coincurve/cross_compile.patch b/kivy_ios/recipes/coincurve/cross_compile.patch new file mode 100644 index 0000000..fbbdd49 --- /dev/null +++ b/kivy_ios/recipes/coincurve/cross_compile.patch @@ -0,0 +1,12 @@ +diff --git a/setup.py b/setup.py +index c224fb2..bf925bd 100644 +--- a/setup.py ++++ b/setup.py +@@ -182,6 +182,7 @@ class build_clib(_build_clib): + '--disable-dependency-tracking', + '--with-pic', + '--enable-module-recovery', ++ "--host=%s" % os.environ['TOOLCHAIN_PREFIX'], + '--disable-jni', + '--prefix', + os.path.abspath(self.build_clib), diff --git a/kivy_ios/recipes/coincurve/drop_setup_requires.patch b/kivy_ios/recipes/coincurve/drop_setup_requires.patch new file mode 100644 index 0000000..9994b3f --- /dev/null +++ b/kivy_ios/recipes/coincurve/drop_setup_requires.patch @@ -0,0 +1,12 @@ +diff --git a/setup.py b/setup.py +index c224fb2..466e789 100644 +--- a/setup.py ++++ b/setup.py +@@ -250,7 +250,6 @@ else: + def has_c_libraries(self): + return not has_system_lib() + setup_kwargs = dict( +- setup_requires=['cffi>=1.3.0', 'pytest-runner>=2.6.2'], + ext_package='coincurve', + cffi_modules=['_cffi_build/build.py:ffi'], + cmdclass={ diff --git a/kivy_ios/recipes/coincurve/find_lib.patch b/kivy_ios/recipes/coincurve/find_lib.patch new file mode 100644 index 0000000..3d3c41d --- /dev/null +++ b/kivy_ios/recipes/coincurve/find_lib.patch @@ -0,0 +1,13 @@ +diff --git a/setup_support.py b/setup_support.py +index e7a4f2e..72f0c4d 100644 +--- a/setup_support.py ++++ b/setup_support.py +@@ -68,6 +69,8 @@ def build_flags(library, type_, path): + + + def _find_lib(): ++ # we're picking up the recipe one ++ return True + from cffi import FFI + ffi = FFI() + try: diff --git a/kivy_ios/recipes/coincurve/no-download.patch b/kivy_ios/recipes/coincurve/no-download.patch new file mode 100644 index 0000000..fcf4d20 --- /dev/null +++ b/kivy_ios/recipes/coincurve/no-download.patch @@ -0,0 +1,13 @@ +diff --git a/setup.py b/setup.py +index c224fb2..d5f6d1a 100644 +--- a/setup.py ++++ b/setup.py +@@ -51,6 +51,8 @@ if [int(i) for i in setuptools_version.split('.', 2)[:2]] < [3, 3]: + + + def download_library(command): ++ # we will use the custom libsecp256k1 recipe ++ return + if command.dry_run: + return + libdir = absolute('libsecp256k1') diff --git a/kivy_ios/recipes/coincurve/setup.py.patch b/kivy_ios/recipes/coincurve/setup.py.patch new file mode 100644 index 0000000..bdc7ab4 --- /dev/null +++ b/kivy_ios/recipes/coincurve/setup.py.patch @@ -0,0 +1,22 @@ +From bf3a0684e9b0af29d9777f61d6e7e1d3cc0f2803 Mon Sep 17 00:00:00 2001 +From: Kieran Prasch <kieranprasch@gmail.com> +Date: Thu, 19 Jul 2018 14:11:48 -0700 +Subject: [PATCH] Exclude tests in setup.py + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 0b579f1..0a793ed 100644 +--- a/setup.py ++++ b/setup.py +@@ -277,7 +277,7 @@ def has_c_libraries(self): + install_requires=['asn1crypto', 'cffi>=1.3.0'], + tests_require=['pytest>=2.8.7'], + +- packages=find_packages(exclude=('_cffi_build', '_cffi_build.*', 'libsecp256k1')), ++ packages=find_packages(exclude=('_cffi_build', '_cffi_build.*', 'libsecp256k1', 'tests')), + + distclass=Distribution, + zip_safe=False, diff --git a/kivy_ios/recipes/colorama/__init__.py b/kivy_ios/recipes/colorama/__init__.py index b3728f4..ebdad2d 100644 --- a/kivy_ios/recipes/colorama/__init__.py +++ b/kivy_ios/recipes/colorama/__init__.py @@ -1,4 +1,4 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os @@ -6,15 +6,15 @@ class ColoramaRecipe(PythonRecipe): version = "0.3.7" url = "https://pypi.python.org/packages/source/c/colorama/colorama-{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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = ColoramaRecipe() diff --git a/kivy_ios/recipes/constantly/__init__.py b/kivy_ios/recipes/constantly/__init__.py deleted file mode 100644 index 8aaa965..0000000 --- a/kivy_ios/recipes/constantly/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class ConstantlyRecipe(PythonRecipe): - version = "15.1.0" - url = "https://pypi.python.org/packages/source/c/constantly/constantly-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = ConstantlyRecipe() diff --git a/kivy_ios/recipes/cryptography/__init__.py b/kivy_ios/recipes/cryptography/__init__.py index 42fe487..6fa407f 100644 --- a/kivy_ios/recipes/cryptography/__init__.py +++ b/kivy_ios/recipes/cryptography/__init__.py @@ -1,60 +1,54 @@ from os.path import join -from toolchain import CythonRecipe, PythonRecipe, Recipe -from toolchain import shprint +from kivy_ios.toolchain import CythonRecipe, Recipe, shprint +from kivy_ios.context_managers import cd import os import sh class CryptographyRecipe(CythonRecipe): name = "cryptography" - version = "2.2.2" + version = "3.1.1" url = "https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz" library = "libcryptography.a" - depends = ["host_setuptools", "host_cffi", "setuptools", "asn1crypto", - "cffi", "enum34", "idna", "ipaddress", "six"] - cythonize = False - - def prebuild_arch(self, arch): - if self.has_marker("patched"): - return - self.apply_patch("getentropy.patch") - self.apply_patch("osrandom.patch") - self.set_marker("patched") + depends = ["host_setuptools3", "host_cffi", "cffi", "asn1crypto", "idna", "six"] + python_depends = ["setuptools"] + cythonize = True + pre_build_ext = True + + def dest_dir(self): + return join(self.ctx.dist_dir, "root", "python3") def get_recipe_env(self, arch): env = super(CryptographyRecipe, self).get_recipe_env(arch) r = self.get_recipe('openssl', self.ctx) openssl_dir = r.get_build_dir(arch.arch) - target_python = Recipe.get_recipe('python', self.ctx).get_build_dir(arch.arch) + target_python = Recipe.get_recipe('python3', self.ctx).get_build_dir(arch.arch) + env['LDFLAGS'] += ' -L' + target_python - env['PYTHON_ROOT'] = join(self.ctx.dist_dir, "root", "python") + env['PYTHON_ROOT'] = join(self.ctx.dist_dir, "root", "python3") env["CC"] = "clang -Qunused-arguments -fcolor-diagnostics" - env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \ + env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.8' + \ ' -I' + join(openssl_dir, 'include') + \ ' -I' + join(self.ctx.dist_dir, "include", arch.arch, "libffi") env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \ ' -L' + openssl_dir + \ - ' -lpython2.7' + \ - ' -lssl' + r.version + \ - ' -lcrypto' + r.version + ' -lpython3.8' + \ + ' -lssl' + \ + ' -lcrypto' + \ + ' -lffi' + \ + ' -lcffi' return env - + def install(self): arch = list(self.filtered_archs)[0] build_dir = self.get_build_dir(arch.arch) os.chdir(build_dir) - - # manually create expected directory in build directory - scripts_dir = join("build", "scripts-2.7") - if not os.path.exists(scripts_dir): - os.makedirs(scripts_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) + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') + with cd(build_dir): + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + recipe = CryptographyRecipe() diff --git a/kivy_ios/recipes/cryptography/getentropy.patch b/kivy_ios/recipes/cryptography/getentropy.patch index 97b8a84..2929ee9 100644 --- a/kivy_ios/recipes/cryptography/getentropy.patch +++ b/kivy_ios/recipes/cryptography/getentropy.patch @@ -1,6 +1,6 @@ ---- cryptography-2.2.2/src/_cffi_src/openssl/src/osrandom_engine.c 2018-03-27 15:12:05.000000000 +0100 -+++ cryptography-2.2.2-patch/src/_cffi_src/openssl/src/osrandom_engine.c 2018-06-02 05:21:49.000000000 +0100 -@@ -205,14 +205,10 @@ +--- a/src/_cffi_src/openssl/src/osrandom_engine.c 2019-01-22 17:41:49.000000000 +0100 ++++ b/src/_cffi_src/openssl/src/osrandom_engine.c 2019-08-12 11:47:03.000000000 +0100 +@@ -243,14 +243,10 @@ #if !defined(__APPLE__) getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS; #else @@ -19,14 +19,14 @@ } #endif return 1; -@@ -228,22 +224,7 @@ +@@ -266,22 +262,7 @@ return dev_urandom_read(buffer, size); #endif case CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS: - while (size > 0) { - /* OpenBSD and macOS restrict maximum buffer size to 256. */ -- len = size > 256 ? 256 : (size_t)size; -- res = getentropy(buffer, len); +- len = size > 256 ? 256 : size; +- res = getentropy(buffer, (size_t)len); - if (res < 0) { - ERR_Cryptography_OSRandom_error( - CRYPTOGRAPHY_OSRANDOM_F_RAND_BYTES, diff --git a/kivy_ios/recipes/defusedxml/__init__.py b/kivy_ios/recipes/defusedxml/__init__.py new file mode 100644 index 0000000..1cb91c4 --- /dev/null +++ b/kivy_ios/recipes/defusedxml/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class DefusedXmlRecipe(PythonRecipe): + version = "0.6.0" + url = "https://pypi.python.org/packages/source/d/defusedxml/defusedxml-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = DefusedXmlRecipe() diff --git a/kivy_ios/recipes/dnspython/__init__.py b/kivy_ios/recipes/dnspython/__init__.py deleted file mode 100644 index 96de195..0000000 --- a/kivy_ios/recipes/dnspython/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class DnsPythonRecipe(PythonRecipe): - version = "1.12.0" - url = "http://www.dnspython.org/kits/{version}/dnspython-{version}.zip" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = DnsPythonRecipe() diff --git a/kivy_ios/recipes/docopt/__init__.py b/kivy_ios/recipes/docopt/__init__.py index f6d9638..61a93d3 100644 --- a/kivy_ios/recipes/docopt/__init__.py +++ b/kivy_ios/recipes/docopt/__init__.py @@ -1,20 +1,20 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class DocoptRecipe(PythonRecipe): version = "0.6.2" url = "https://pypi.python.org/packages/source/d/docopt/docopt-{version}.tar.gz" - depends = ["python", "setuptools"] - + 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = DocoptRecipe() diff --git a/kivy_ios/recipes/ecdsa/__init__.py b/kivy_ios/recipes/ecdsa/__init__.py index 062f443..3b4afdf 100644 --- a/kivy_ios/recipes/ecdsa/__init__.py +++ b/kivy_ios/recipes/ecdsa/__init__.py @@ -1,20 +1,20 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class EcdsaRecipe(PythonRecipe): version = "0.13" url = "https://pypi.python.org/packages/source/e/ecdsa/ecdsa-{version}.tar.gz" - depends = ["python", "setuptools"] - + 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = EcdsaRecipe() diff --git a/kivy_ios/recipes/enum34/__init__.py b/kivy_ios/recipes/enum34/__init__.py deleted file mode 100644 index 9635622..0000000 --- a/kivy_ios/recipes/enum34/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class Enum34Recipe(PythonRecipe): - version = "1.1.6" - url = "https://pypi.python.org/packages/source/e/enum34/enum34-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = Enum34Recipe() diff --git a/kivy_ios/recipes/envparse/__init__.py b/kivy_ios/recipes/envparse/__init__.py deleted file mode 100644 index 66965b0..0000000 --- a/kivy_ios/recipes/envparse/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class EnvparseRecipe(PythonRecipe): - version = "0.2.0" - url = "https://pypi.python.org/packages/source/e/envparse/envparse-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = EnvparseRecipe() diff --git a/kivy_ios/recipes/flask/__init__.py b/kivy_ios/recipes/flask/__init__.py index 5d2847f..fd39a77 100644 --- a/kivy_ios/recipes/flask/__init__.py +++ b/kivy_ios/recipes/flask/__init__.py @@ -16,7 +16,7 @@ class FlaskRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") + dest_dir = join(self.ctx.dist_dir, "root", "python3") build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) diff --git a/kivy_ios/recipes/functools32/__init__.py b/kivy_ios/recipes/functools32/__init__.py deleted file mode 100644 index ea5be50..0000000 --- a/kivy_ios/recipes/functools32/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class Functools32Recipe(PythonRecipe): - version = "3.2.3-2" - url = "https://pypi.python.org/packages/source/f/functools32/functools32-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = Functools32Recipe() diff --git a/kivy_ios/recipes/hachoir/__init__.py b/kivy_ios/recipes/hachoir/__init__.py new file mode 100644 index 0000000..fe9650c --- /dev/null +++ b/kivy_ios/recipes/hachoir/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class HachoirRecipe(PythonRecipe): + version = "3.1.1" + url = "https://pypi.python.org/packages/source/h/hachoir/hachoir-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = HachoirRecipe() diff --git a/kivy_ios/recipes/host_cffi/__init__.py b/kivy_ios/recipes/host_cffi/__init__.py index 1a8aa5f..e48bd0d 100644 --- a/kivy_ios/recipes/host_cffi/__init__.py +++ b/kivy_ios/recipes/host_cffi/__init__.py @@ -1,6 +1,5 @@ from os.path import join -from toolchain import Recipe -from toolchain import shprint +from kivy_ios.toolchain import Recipe, shprint import os import sh @@ -19,10 +18,10 @@ Cflags: -I${includedir} class HostCffiRecipe(Recipe): name = "host_cffi" - version = "1.11.5" + version = "1.14.3" archs = ["x86_64"] url = "https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz" - depends = ["libffi", "host_setuptools", "pycparser"] + depends = ["hostlibffi", "pycparser"] def get_recipe_env(self, arch): sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip() diff --git a/kivy_ios/recipes/host_setuptools/__init__.py b/kivy_ios/recipes/host_setuptools/__init__.py index 5480225..e42a0bf 100644 --- a/kivy_ios/recipes/host_setuptools/__init__.py +++ b/kivy_ios/recipes/host_setuptools/__init__.py @@ -18,13 +18,13 @@ class HostSetuptools(Recipe): # python package installations using setuptools will raise exceptions. # Setuptools version 28.3.0 site_packages_path = join( - self.ctx.dist_dir, 'hostpython', - 'lib', 'python3.7', 'site-packages') + self.ctx.dist_dir, 'hostpython3', + 'lib', 'python3.8', 'site-packages') os.chdir(site_packages_path) with open('setuptools.pth', 'r') as f: setuptools_egg_path = f.read().strip('./').strip('\n') unzip = sh.Command('unzip') - shprint(unzip, setuptools_egg_path) + shprint(unzip, '-o', setuptools_egg_path) os.remove(setuptools_egg_path) os.remove('setuptools.pth') os.remove('easy-install.pth') diff --git a/kivy_ios/recipes/hostopenssl/__init__.py b/kivy_ios/recipes/hostopenssl/__init__.py index 8af912d..a42e880 100644 --- a/kivy_ios/recipes/hostopenssl/__init__.py +++ b/kivy_ios/recipes/hostopenssl/__init__.py @@ -1,73 +1,39 @@ -from toolchain import Recipe, shprint -from os.path import join, exists, basename, dirname -from os import makedirs +from kivy_ios.toolchain import Recipe, shprint +from os.path import join import sh -import shutil +import logging -def ensure_dir(filename): - if not exists(filename): - makedirs(filename) +logger = logging.getLogger(__name__) -class HostOpenSSLRecipe(Recipe): - version = "1.0.2l" + +class HostOpensslRecipe(Recipe): + version = "1.1.1f" url = "http://www.openssl.org/source/openssl-{version}.tar.gz" archs = ["x86_64"] - libraries = ["libssl.a", "libcrypto.a"] - include_dir = "include" + + def get_build_env(self): + build_env = self.ctx.env.copy() + self.build_env_x86_84 = build_env + return build_env def build_x86_64(self): - arch = self.archs[0] - sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip() - dist_dir = join(self.ctx.dist_dir,"hostopenssl") - print("OpenSSL for host to be installed at: {}").format(dist_dir) - sh.perl(join(self.build_dir, "Configure"), "darwin64-x86_64-cc", - "--openssldir={}".format(dist_dir), - "--prefix={}".format(dist_dir)) - + build_env = self.get_build_env() + configure = sh.Command(join(self.build_dir, "Configure")) + shprint(configure, + "darwin64-x86_64-cc", + _env=build_env) shprint(sh.make, "clean") - shprint(sh.make, "-j4", "build_libs") + shprint(sh.make, self.ctx.concurrent_make, "build_libs") - def install_include(self): - arch = self.archs[0] - print("Custom include file install...") - print("Dist dir = {}".format(self.ctx.dist_dir)) - dest_dir = join(self.ctx.dist_dir,"hostopenssl","include") - if exists(dest_dir): - shutil.rmtree(dest_dir) - src_dir = join(self.ctx.build_dir,"hostopenssl",arch,"openssl-{}".format(self.version),"include") - shutil.copytree(src_dir,dest_dir) + def install(self): + sh.mkdir('-p', join(self.ctx.dist_dir, 'hostopenssl')) + sh.cp('-r', join(self.get_build_dir('x86_64'), 'include'), + join(self.ctx.dist_dir, 'hostopenssl', 'include')) + sh.mkdir('-p', join(self.ctx.dist_dir, 'hostopenssl', 'lib')) + sh.cp(join(self.get_build_dir('x86_64'), 'libssl.a'), + join(self.ctx.dist_dir, 'hostopenssl', 'lib')) + sh.cp(join(self.get_build_dir('x86_64'), 'libcrypto.a'), + join(self.ctx.dist_dir, 'hostopenssl', 'lib')) - def build_all(self): - filtered_archs = self.filtered_archs - print("Build {} for {} (filtered)".format( - self.name, - ", ".join([x.arch for x in filtered_archs]))) - for arch in self.filtered_archs: - self.build(arch) - name = self.name - if self.library: - print("Create lipo library for {}".format(name)) - if not name.startswith("lib"): - name = "lib{}".format(name) - static_fn = join(self.ctx.dist_dir, "hostopenssl", "lib", "{}.a".format(name)) - ensure_dir(dirname(static_fn)) - print("Lipo {} to {}".format(self.name, static_fn)) - self.make_lipo(static_fn) - if self.libraries: - print("Create multiple lipo for {}".format(name)) - for library in self.libraries: - static_fn = join(self.ctx.dist_dir, "hostopenssl", "lib", basename(library)) - ensure_dir(dirname(static_fn)) - print(" - Lipo-ize {}".format(library)) - self.make_lipo(static_fn, library) - print("Install include files for {}".format(self.name)) - self.install_include() - print("Install frameworks for {}".format(self.name)) - self.install_frameworks() - print("Install sources for {}".format(self.name)) - self.install_sources() - print("Install {}".format(self.name)) - self.install() - -recipe = HostOpenSSLRecipe() +recipe = HostOpensslRecipe() diff --git a/kivy_ios/recipes/idna/__init__.py b/kivy_ios/recipes/idna/__init__.py index 1e477b2..ecf69a2 100644 --- a/kivy_ios/recipes/idna/__init__.py +++ b/kivy_ios/recipes/idna/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class IdnaRecipe(PythonRecipe): version = "2.6" url = "https://pypi.python.org/packages/source/i/idna/idna-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class IdnaRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = IdnaRecipe() diff --git a/kivy_ios/recipes/incremental/__init__.py b/kivy_ios/recipes/incremental/__init__.py deleted file mode 100644 index f0e7461..0000000 --- a/kivy_ios/recipes/incremental/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class IncrementalRecipe(PythonRecipe): - version = "17.5.0" - url = "https://pypi.python.org/packages/source/i/incremental/incremental-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = IncrementalRecipe() diff --git a/kivy_ios/recipes/ios/__init__.py b/kivy_ios/recipes/ios/__init__.py index 801ab11..cd6dab1 100644 --- a/kivy_ios/recipes/ios/__init__.py +++ b/kivy_ios/recipes/ios/__init__.py @@ -8,20 +8,6 @@ class IosRecipe(CythonRecipe): depends = ["python"] pbx_frameworks = ["MessageUI", "CoreMotion", "UIKit", "WebKit", "Photos"] - def prebuild_arch(self, arch): - from os.path import join - destdir = self.get_build_dir(arch.arch) - local_arch = arch.arch - if arch.arch == "arm64" : - local_arch = "aarch64" - if arch.arch == "armv7" : - local_arch = "arm" - build_dir = join(destdir, "../../../python", arch.arch, "Python-2.7.13", "build", "lib.darwin-{}-2.7".format(local_arch)) - print("build_dir = "+build_dir) - copyfile = join(build_dir,"_sysconfigdata.py") - # Copy _sysconfigdata.py for this architecture across - self.copy_file(copyfile, destdir) - def install(self): self.install_python_package( name=self.so_filename("ios"), is_dir=False) diff --git a/kivy_ios/recipes/ipaddress/__init__.py b/kivy_ios/recipes/ipaddress/__init__.py index c3b3d52..3c732c3 100644 --- a/kivy_ios/recipes/ipaddress/__init__.py +++ b/kivy_ios/recipes/ipaddress/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class IpaddressRecipe(PythonRecipe): version = "1.0.22" url = "https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class IpaddressRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = IpaddressRecipe() diff --git a/kivy_ios/recipes/jsonrpc/__init__.py b/kivy_ios/recipes/jsonrpc/__init__.py deleted file mode 100644 index 6261b51..0000000 --- a/kivy_ios/recipes/jsonrpc/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class JsonrpcRecipe(PythonRecipe): - version = "1.2" - url = "https://pypi.python.org/packages/source/j/jsonrpc/jsonrpc-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = JsonrpcRecipe() diff --git a/kivy_ios/recipes/jsonrpclib/__init__.py b/kivy_ios/recipes/jsonrpclib/__init__.py deleted file mode 100644 index 08f89f5..0000000 --- a/kivy_ios/recipes/jsonrpclib/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class JsonrpclibRecipe(PythonRecipe): - version = "0.1.7" - url = "https://pypi.python.org/packages/source/j/jsonrpclib/jsonrpclib-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = JsonrpclibRecipe() diff --git a/kivy_ios/recipes/jsonschema/__init__.py b/kivy_ios/recipes/jsonschema/__init__.py index 84522bb..a5d1311 100644 --- a/kivy_ios/recipes/jsonschema/__init__.py +++ b/kivy_ios/recipes/jsonschema/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class JsonschemaRecipe(PythonRecipe): version = "2.6.0" url = "https://pypi.python.org/packages/source/j/jsonschema/jsonschema-{version}.tar.gz" - depends = ["python", "setuptools", "functools32"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class JsonschemaRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = JsonschemaRecipe() diff --git a/kivy_ios/recipes/keyring/__init__.py b/kivy_ios/recipes/keyring/__init__.py index ab02d6c..73c1a86 100644 --- a/kivy_ios/recipes/keyring/__init__.py +++ b/kivy_ios/recipes/keyring/__init__.py @@ -1,20 +1,20 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class KeyringRecipe(PythonRecipe): version = "10.4.0" url = "https://pypi.python.org/packages/source/k/keyring/keyring-{version}.tar.gz" - depends = ["python", "setuptools"] - + 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = KeyringRecipe() diff --git a/kivy_ios/recipes/kivent_core/__init__.py b/kivy_ios/recipes/kivent_core/__init__.py index eba4202..18563ed 100644 --- a/kivy_ios/recipes/kivent_core/__init__.py +++ b/kivy_ios/recipes/kivent_core/__init__.py @@ -77,7 +77,7 @@ class KiventCoreRecipe(CythonRecipe): # build_env = arch.get_env() build_env = self.get_recipe_env(arch) - dest_dir = join(self.ctx.dist_dir, "root", "python") + dest_dir = join(self.ctx.dist_dir, "root", "python3") build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7', 'site-packages') # Add Architecture specific kivy path for 'import kivy' to PYTHONPATH diff --git a/kivy_ios/recipes/kivy/__init__.py b/kivy_ios/recipes/kivy/__init__.py index b9be254..c03e80b 100644 --- a/kivy_ios/recipes/kivy/__init__.py +++ b/kivy_ios/recipes/kivy/__init__.py @@ -31,20 +31,6 @@ class KivyRecipe(CythonRecipe): join(self.ctx.dist_dir, "include", "common", "sdl2_mixer")]) return env - def prebuild_arch(self, arch): - from os.path import join - destdir = self.get_build_dir(arch.arch) - local_arch = arch.arch - if arch.arch == "arm64" : - local_arch = "aarch64" - if arch.arch == "armv7" : - local_arch = "arm" - build_dir = join(destdir, "../../../python", arch.arch, "Python-2.7.13", "build", "lib.darwin-{}-2.7".format(local_arch)) - print("build_dir = "+build_dir) - copyfile = join(build_dir,"_sysconfigdata.py") - # Copy _sysconfigdata.py for this architecture across - self.copy_file(copyfile, destdir) - def build_arch(self, arch): self._patch_setup() super().build_arch(arch) diff --git a/kivy_ios/recipes/lbry/__init__.py b/kivy_ios/recipes/lbry/__init__.py index 4a425ae..dbed1df 100644 --- a/kivy_ios/recipes/lbry/__init__.py +++ b/kivy_ios/recipes/lbry/__init__.py @@ -1,51 +1,55 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class LbryRecipe(PythonRecipe): - version = "v0.20.0rc10" + version = "f7eed62" url = "https://github.com/lbryio/lbry/archive/{version}.tar.gz" depends = [ "python", - "setuptools", - "twisted", - "cryptography", + "ios", + "pyobjus", + "kivy", + + # install_requires dependencies + "aiohttp", + "aioupnp", "appdirs", - "argparse", - "docopt", + "async-timeout", "base58", + "chardet", + "coincurve", "colorama", - "dnspython", + "cryptography", + "defusedxml", + "docopt", "ecdsa", - "envparse", - "jsonrpc", - "jsonrpclib", + "hachoir", "keyring", - "lbryschema", - "lbryum", - "miniupnpc", + "mock", + "msgpack", "pbkdf2", + "prometheus_client", + "protobuf", + "pylru", "pyyaml", - "pygithub", - "qrcode", - "requests", - "service_identity", - "six", - "slowaes", - "txjson-rpc", - "wsgiref", - "zope_interface", - "treq" + "six" ] + def prebuild_arch(self, arch): + if self.has_marker("patched"): + return + self.apply_patch("setup_override.patch") + self.set_marker("patched") + 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = LbryRecipe() diff --git a/kivy_ios/recipes/lbry/setup_override.patch b/kivy_ios/recipes/lbry/setup_override.patch new file mode 100644 index 0000000..1b899c2 --- /dev/null +++ b/kivy_ios/recipes/lbry/setup_override.patch @@ -0,0 +1,33 @@ +--- a/setup.py 2020-09-28 10:43:56.000000000 +0100 ++++ b/setup.py 2020-09-28 10:44:34.000000000 +0100 +@@ -32,29 +32,7 @@ + 'orchstr8=lbry.wallet.orchstr8.cli:main', + ], + }, +- install_requires=[ +- 'aiohttp==3.5.4', +- 'aioupnp==0.0.17', +- 'appdirs==1.4.3', +- 'certifi>=2018.11.29', +- 'colorama==0.3.7', +- 'distro==1.4.0', +- 'base58==1.0.0', +- 'cffi==1.13.2', +- 'cryptography==2.5', +- 'protobuf==3.6.1', +- 'msgpack==0.6.1', +- 'prometheus_client==0.7.1', +- 'ecdsa==0.13.3', +- 'pyyaml==5.3.1', +- 'docopt==0.6.2', +- 'hachoir', +- 'multidict==4.6.1', +- 'coincurve==11.0.0', +- 'pbkdf2==1.3', +- 'attrs==18.2.0', +- 'pylru==1.1.0' +- ] + PLYVEL, ++ install_requires=[], + classifiers=[ + 'Framework :: AsyncIO', + 'Intended Audience :: Developers', diff --git a/kivy_ios/recipes/lbryschema/__init__.py b/kivy_ios/recipes/lbryschema/__init__.py deleted file mode 100644 index a228d06..0000000 --- a/kivy_ios/recipes/lbryschema/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class LbrySchemaRecipe(PythonRecipe): - version = "v0.0.16rc2" - url = "https://github.com/lbryio/lbryschema/archive/{version}.tar.gz" - depends = ["python", "setuptools", "ecdsa", "jsonschema", "protobuf"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = LbrySchemaRecipe() diff --git a/kivy_ios/recipes/lbryum/__init__.py b/kivy_ios/recipes/lbryum/__init__.py deleted file mode 100644 index fc56507..0000000 --- a/kivy_ios/recipes/lbryum/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class LbryumRecipe(PythonRecipe): - version = "v3.2.2rc1" - url = "https://github.com/lbryio/lbryum/archive/{version}.tar.gz" - depends = ["python", "setuptools", "appdirs", "ecdsa", "jsonrpclib", "keyring", "lbryschema"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = LbryumRecipe() diff --git a/kivy_ios/recipes/libsecp256k1/__init__.py b/kivy_ios/recipes/libsecp256k1/__init__.py new file mode 100644 index 0000000..50c9081 --- /dev/null +++ b/kivy_ios/recipes/libsecp256k1/__init__.py @@ -0,0 +1,29 @@ +from kivy_ios.toolchain import Recipe, shprint +from os.path import join, exists +from multiprocessing import cpu_count +import sh + +class LibSecp256k1Recipe(Recipe): + version = 'b0452e6' + url = 'https://github.com/bitcoin-core/secp256k1/archive/{version}.zip' + library = '.libs/libsecp256k1.a' + include_per_arch = True + + def build_arch(self, arch): + super(LibSecp256k1Recipe, self).build_arch(arch) + env = self.get_recipe_env(arch) + + if not exists(join(self.build_dir, "configure")): + shprint(sh.Command('./autogen.sh')) + shprint( + sh.Command('./configure'), + '--host=' + arch.triple, + '--prefix=/', + '--enable-module-recovery', + '--enable-experimental', + '--enable-module-ecdh', + '--disable-shared', + _env=env) + shprint(sh.make, '-j' + str(cpu_count()), _env=env) + +recipe = LibSecp256k1Recipe() diff --git a/kivy_ios/recipes/miniupnpc/__init__.py b/kivy_ios/recipes/miniupnpc/__init__.py deleted file mode 100644 index 4992d1e..0000000 --- a/kivy_ios/recipes/miniupnpc/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -from toolchain import CythonRecipe, shprint -from os.path import join -import os -import sh - - -class MiniupnpcRecipe(CythonRecipe): - name = "miniupnpc" - version = "1.9" - url = "https://pypi.python.org/packages/source/m/miniupnpc/miniupnpc-{version}.tar.gz" - library = "libminiupnpc.a" - depends = ["python", "setuptools"] - cythonize = False - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - - -recipe = MiniupnpcRecipe() diff --git a/kivy_ios/recipes/mock/__init__.py b/kivy_ios/recipes/mock/__init__.py new file mode 100644 index 0000000..56de49f --- /dev/null +++ b/kivy_ios/recipes/mock/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class MockRecipe(PythonRecipe): + version = "4.0.2" + url = "https://pypi.python.org/packages/source/m/mock/mock-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = MockRecipe() diff --git a/kivy_ios/recipes/msgpack/__init__.py b/kivy_ios/recipes/msgpack/__init__.py new file mode 100644 index 0000000..b3f4a93 --- /dev/null +++ b/kivy_ios/recipes/msgpack/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class MsgpackRecipe(PythonRecipe): + version = "0.6.1" + url = "https://pypi.python.org/packages/source/m/msgpack/msgpack-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = MsgpackRecipe() diff --git a/kivy_ios/recipes/multidict/__init__.py b/kivy_ios/recipes/multidict/__init__.py new file mode 100644 index 0000000..0360961 --- /dev/null +++ b/kivy_ios/recipes/multidict/__init__.py @@ -0,0 +1,22 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class MultidictRecipe(PythonRecipe): + version = "4.5.2" + url = "https://pypi.python.org/packages/source/m/multidict/multidict-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = MultidictRecipe() diff --git a/kivy_ios/recipes/pbkdf2/__init__.py b/kivy_ios/recipes/pbkdf2/__init__.py index ce3fc5d..da04dd2 100644 --- a/kivy_ios/recipes/pbkdf2/__init__.py +++ b/kivy_ios/recipes/pbkdf2/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class Pbkdf2Recipe(PythonRecipe): version = "1.3" url = "https://pypi.python.org/packages/source/p/pbkdf2/pbkdf2-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class Pbkdf2Recipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - + recipe = Pbkdf2Recipe() diff --git a/kivy_ios/recipes/prometheus_client/__init__.py b/kivy_ios/recipes/prometheus_client/__init__.py new file mode 100644 index 0000000..bccc2fe --- /dev/null +++ b/kivy_ios/recipes/prometheus_client/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class PrometheusClientRecipe(PythonRecipe): + version = "0.8.0" + url = "https://pypi.python.org/packages/source/p/prometheus_client/prometheus_client-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = PrometheusClientRecipe() diff --git a/kivy_ios/recipes/protobuf/__init__.py b/kivy_ios/recipes/protobuf/__init__.py index bc04bd0..46e0f28 100644 --- a/kivy_ios/recipes/protobuf/__init__.py +++ b/kivy_ios/recipes/protobuf/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class ProtobufRecipe(PythonRecipe): - version = "3.2.0" + version = "3.6.1" url = "https://pypi.python.org/packages/source/p/protobuf/protobuf-{version}.tar.gz" - depends = ["python", "setuptools", "six"] + depends = ["python", "six"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,9 +13,8 @@ class ProtobufRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PATH'] = '' - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = ProtobufRecipe() diff --git a/kivy_ios/recipes/pyasn1-modules/__init__.py b/kivy_ios/recipes/pyasn1-modules/__init__.py index ada572c..f757696 100644 --- a/kivy_ios/recipes/pyasn1-modules/__init__.py +++ b/kivy_ios/recipes/pyasn1-modules/__init__.py @@ -1,20 +1,20 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class Pyasn1ModulesRecipe(PythonRecipe): version = "0.2.1" url = "https://pypi.python.org/packages/source/p/pyasn1-modules/pyasn1-modules-{version}.tar.gz" - depends = ["python", "setuptools", "pyasn1"] - + depends = ["python", "pyasn1"] + 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = Pyasn1ModulesRecipe() diff --git a/kivy_ios/recipes/pyasn1/__init__.py b/kivy_ios/recipes/pyasn1/__init__.py index 45a2f22..934908b 100644 --- a/kivy_ios/recipes/pyasn1/__init__.py +++ b/kivy_ios/recipes/pyasn1/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class Pyasn1Recipe(PythonRecipe): version = "0.4.3" url = "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,9 @@ class Pyasn1Recipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + recipe = Pyasn1Recipe() diff --git a/kivy_ios/recipes/pycparser/__init__.py b/kivy_ios/recipes/pycparser/__init__.py index d2d8a68..7bccdcd 100644 --- a/kivy_ios/recipes/pycparser/__init__.py +++ b/kivy_ios/recipes/pycparser/__init__.py @@ -1,12 +1,11 @@ -from os.path import join -from toolchain import PythonRecipe -from toolchain import shprint +# pure-python package, this can be removed when we'll support any python package import os import sh +from kivy_ios.toolchain import PythonRecipe, shprint class PycparserRecipe(PythonRecipe): - version = "2.18" + version = "2.20" url = "https://pypi.python.org/packages/source/p/pycparser/pycparser-{version}.tar.gz" depends = ["python"] @@ -14,19 +13,11 @@ class PycparserRecipe(PythonRecipe): arch = list(self.filtered_archs)[0] build_dir = self.get_build_dir(arch.arch) os.chdir(build_dir) - # manually create expected directory in build directory - scripts_dir = join("build", "scripts-2.7") - if not os.path.exists(scripts_dir): - os.makedirs(scripts_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 - build_env['PYTHONHOME'] = '/usr' - args = [hostpython, "setup.py", "install", "--prefix", dest_dir] - shprint(*args, _env=build_env) - #args = [hostpython, "setup.py", "install"] - #shprint(*args, _env=build_env) + dest_dir = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + recipe = PycparserRecipe() diff --git a/kivy_ios/recipes/pycrypto/__init__.py b/kivy_ios/recipes/pycrypto/__init__.py index 3c49c19..f9a8cf9 100644 --- a/kivy_ios/recipes/pycrypto/__init__.py +++ b/kivy_ios/recipes/pycrypto/__init__.py @@ -33,7 +33,7 @@ class PycryptoRecipe(CythonRecipe): build_dir = self.get_build_dir(arch.arch) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") + dest_dir = join(self.ctx.dist_dir, "root", "python3") build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7', 'site-packages') with cd(build_dir): shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) diff --git a/kivy_ios/recipes/pygithub/__init__.py b/kivy_ios/recipes/pygithub/__init__.py deleted file mode 100644 index 6c54686..0000000 --- a/kivy_ios/recipes/pygithub/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class PyGithubRecipe(PythonRecipe): - version = "1.34" - url = "https://pypi.python.org/packages/source/p/pygithub/PyGithub-{version}.tar.gz" - depends = ["python", "setuptools", "pyjwt"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = PyGithubRecipe() diff --git a/kivy_ios/recipes/pyjwt/__init__.py b/kivy_ios/recipes/pyjwt/__init__.py deleted file mode 100644 index 2f6212b..0000000 --- a/kivy_ios/recipes/pyjwt/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class PyJWTRecipe(PythonRecipe): - version = "1.6.4" - url = "https://pypi.python.org/packages/source/p/pyjwt/PyJWT-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = PyJWTRecipe() diff --git a/kivy_ios/recipes/pylru/__init__.py b/kivy_ios/recipes/pylru/__init__.py new file mode 100644 index 0000000..ad4a8e8 --- /dev/null +++ b/kivy_ios/recipes/pylru/__init__.py @@ -0,0 +1,23 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class PylruRecipe(PythonRecipe): + version = "1.2.0" + url = "https://pypi.python.org/packages/source/p/pylru/pylru-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = PylruRecipe() diff --git a/kivy_ios/recipes/pyopenssl/__init__.py b/kivy_ios/recipes/pyopenssl/__init__.py deleted file mode 100644 index f7eaa62..0000000 --- a/kivy_ios/recipes/pyopenssl/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class PyOpenSSLRecipe(PythonRecipe): - version = "17.4.0" - url = "https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-{version}.tar.gz" - depends = ["python", "setuptools", "cryptography", "six"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = PyOpenSSLRecipe() diff --git a/kivy_ios/recipes/python3/ModulesSetup b/kivy_ios/recipes/python3/ModulesSetup index 9a1bfcf..3e22cd5 100644 --- a/kivy_ios/recipes/python3/ModulesSetup +++ b/kivy_ios/recipes/python3/ModulesSetup @@ -28,7 +28,7 @@ _lsprof _lsprof.o rotatingtree.c # _lzma _lzmamodule.c -I$(srcdir)/../xz/include -L$(srcdir)/../Support/XZ -llzma _md5 md5module.c _multibytecodec cjkcodecs/multibytecodec.c -# _multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c +#multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c _opcode _opcode.c _queue _queuemodule.c _pickle _pickle.c @@ -48,7 +48,7 @@ cmath cmathmodule.c _math.c fcntl fcntlmodule.c grp grpmodule.c math mathmodule.c -# mmap mmapmodule.c +mmap mmapmodule.c -I/usr/include parser parsermodule.c pyexpat expat/xmlparse.c \ expat/xmlrole.c \ diff --git a/kivy_ios/recipes/python3/__init__.py b/kivy_ios/recipes/python3/__init__.py index 4ffb113..f051c70 100644 --- a/kivy_ios/recipes/python3/__init__.py +++ b/kivy_ios/recipes/python3/__init__.py @@ -33,6 +33,7 @@ class Python3Recipe(Recipe): self.apply_patch("posixmodule.patch") self.apply_patch("dynload_shlib.patch") self.apply_patch("disable_explicit_blake2.patch") + self.apply_patch("disable_mremap.patch") self.apply_patch("pyconfig_detection.patch") self.copy_file("ModulesSetup", "Modules/Setup.local") self.append_file("ModulesSetup.mobile", "Modules/Setup.local") @@ -172,7 +173,7 @@ class Python3Recipe(Recipe): # cleanup python libraries with cd(join( self.ctx.dist_dir, "root", "python3", "lib", "python3.8")): - sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3", + sh.rm("-rf", "curses", "idlelib", "lib2to3", "ensurepip", "turtledemo", "lib-dynload", "venv", "pydoc_data") sh.find(".", "-path", "*/test*/*", "-delete") diff --git a/kivy_ios/recipes/python3/disable_mremap.patch b/kivy_ios/recipes/python3/disable_mremap.patch new file mode 100644 index 0000000..de5f5d7 --- /dev/null +++ b/kivy_ios/recipes/python3/disable_mremap.patch @@ -0,0 +1,34 @@ +--- a/Modules/mmapmodule.c 2020-09-28 21:41:42.000000000 +0100 ++++ b/Modules/mmapmodule.c 2020-09-28 21:42:35.000000000 +0100 +@@ -527,11 +527,11 @@ + #endif /* MS_WINDOWS */ + + #ifdef UNIX +-#ifndef HAVE_MREMAP ++//#ifndef HAVE_MREMAP + PyErr_SetString(PyExc_SystemError, + "mmap: resizing not available--no mremap()"); + return NULL; +-#else ++/*#else + void *newmap; + + if (self->fd != -1 && ftruncate(self->fd, self->offset + new_size) == -1) { +@@ -546,7 +546,7 @@ + newmap = mremap(self->data, self->size, self->data, new_size, 0); + #else + newmap = mremap(self->data, self->size, new_size, 0); +-#endif /* __NetBSD__ */ ++#endif + #endif + if (newmap == (void *)-1) + { +@@ -556,7 +556,7 @@ + self->data = newmap; + self->size = new_size; + Py_RETURN_NONE; +-#endif /* HAVE_MREMAP */ ++#endif */ + #endif /* UNIX */ + } + } diff --git a/kivy_ios/recipes/pyyaml/__init__.py b/kivy_ios/recipes/pyyaml/__init__.py index 96a20d3..d2d3fea 100644 --- a/kivy_ios/recipes/pyyaml/__init__.py +++ b/kivy_ios/recipes/pyyaml/__init__.py @@ -5,7 +5,7 @@ from kivy_ios.toolchain import PythonRecipe, shprint class PyYamlRecipe(PythonRecipe): - version = "3.12" + version = "5.3.1" url = "https://pypi.python.org/packages/source/P/PyYAML/PyYAML-{version}.tar.gz" depends = ["python"] @@ -15,8 +15,8 @@ class PyYamlRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = os.path.join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.7', 'site-packages') + dest_dir = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) diff --git a/kivy_ios/recipes/qrcode/__init__.py b/kivy_ios/recipes/qrcode/__init__.py deleted file mode 100644 index 59ea1ac..0000000 --- a/kivy_ios/recipes/qrcode/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class QrcodeRecipe(PythonRecipe): - version = "5.2.2" - url = "https://pypi.python.org/packages/source/q/qrcode/qrcode-{version}.tar.gz" - depends = ["python", "setuptools", "colorama", "six"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = QrcodeRecipe() diff --git a/kivy_ios/recipes/requests/__init__.py b/kivy_ios/recipes/requests/__init__.py deleted file mode 100644 index d8fba04..0000000 --- a/kivy_ios/recipes/requests/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class RequestsRecipe(PythonRecipe): - version = "2.9.1" - url = "https://pypi.python.org/packages/source/r/requests/requests-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = RequestsRecipe() diff --git a/kivy_ios/recipes/service_identity/__init__.py b/kivy_ios/recipes/service_identity/__init__.py deleted file mode 100644 index 16a04e7..0000000 --- a/kivy_ios/recipes/service_identity/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class ServiceIdentityRecipe(PythonRecipe): - version = "16.0.0" - url = "https://pypi.python.org/packages/source/s/service_identity/service_identity-{version}.tar.gz" - depends = ["python", "setuptools", "attrs", "pyasn1", "pyasn1-modules", "pyopenssl"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = ServiceIdentityRecipe() diff --git a/kivy_ios/recipes/setuptools/__init__.py b/kivy_ios/recipes/setuptools/__init__.py index f491a11..df4db78 100644 --- a/kivy_ios/recipes/setuptools/__init__.py +++ b/kivy_ios/recipes/setuptools/__init__.py @@ -1,31 +1,23 @@ -from toolchain import CythonRecipe +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint -class SetuptoolsRecipe(CythonRecipe): - name = "setuptools" - version = "18.5" - url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz" - depends = ["python", "host_setuptools"] - cythonize = False - - def get_recipe_env(self, arch): - env = super(SetuptoolsRecipe, self).get_recipe_env(arch) - env["PYTHONPATH"] = self.get_build_dir(arch.arch) + "/iosbuild/lib/python2.7/site-packages" - return env +class SetuptoolsRecipe(PythonRecipe): + version = "41.0.0" + url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip" + depends = ["python"] def install(self): - import sh - from toolchain import shprint - from os import chdir - arch = self.filtered_archs[0] - - build_env = arch.get_env() - + arch = list(self.filtered_archs)[0] build_dir = self.get_build_dir(arch.arch) - chdir(build_dir) + os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) - shprint(hostpython, "setup.py", "install", "--prefix", self.ctx.install_dir, "--old-and-unmanageable") - # "--single-version-externally-managed", "--root", "/", "-O2") + build_env = arch.get_env() + dest_dir = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) -recipe = SetuptoolsRecipe() +recipe = ChardetRecipe() diff --git a/kivy_ios/recipes/six/__init__.py b/kivy_ios/recipes/six/__init__.py index 8c79f4b..e1b2f38 100644 --- a/kivy_ios/recipes/six/__init__.py +++ b/kivy_ios/recipes/six/__init__.py @@ -1,11 +1,11 @@ -from toolchain import PythonRecipe, shprint +from kivy_ios.toolchain import PythonRecipe, shprint from os.path import join import sh, os class SixRecipe(PythonRecipe): version = "1.11.0" url = "https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz" - depends = ["python", "setuptools"] + depends = ["python"] def install(self): arch = list(self.filtered_archs)[0] @@ -13,8 +13,8 @@ class SixRecipe(PythonRecipe): os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + dest_dir = join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages') shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = SixRecipe() diff --git a/kivy_ios/recipes/slowaes/__init__.py b/kivy_ios/recipes/slowaes/__init__.py deleted file mode 100644 index 2f626d2..0000000 --- a/kivy_ios/recipes/slowaes/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class SlowaesRecipe(PythonRecipe): - version = "0.1a1" - url = "https://pypi.python.org/packages/source/s/slowaes/slowaes-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = SlowaesRecipe() diff --git a/kivy_ios/recipes/treq/__init__.py b/kivy_ios/recipes/treq/__init__.py deleted file mode 100644 index 7ebbc22..0000000 --- a/kivy_ios/recipes/treq/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class TreqRecipe(PythonRecipe): - version = "17.8.0" - url = "https://pypi.python.org/packages/source/t/treq/treq-{version}.tar.gz" - depends = ["python", "setuptools", "six", "twisted"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = TreqRecipe() diff --git a/kivy_ios/recipes/twisted/__init__.py b/kivy_ios/recipes/twisted/__init__.py deleted file mode 100644 index 79b4696..0000000 --- a/kivy_ios/recipes/twisted/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -from toolchain import CythonRecipe, shprint -from os.path import join -import os -import sh - - -class TwistedRecipe(CythonRecipe): - name = "twisted" - version = "16.6.0" - url = "https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz" - library = "libtwisted.a" - depends = ["python", "setuptools", "constantly", "incremental", "zope_interface"] - optional_depends = ["pyopenssl"] - cythonize = False - - def prebuild_arch(self, arch): - if self.has_marker("patched"): - return - self.apply_patch("remove_portmap_extension.patch") - - self.set_marker("patched") - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - - -recipe = TwistedRecipe() diff --git a/kivy_ios/recipes/twisted/remove_portmap_extension.patch b/kivy_ios/recipes/twisted/remove_portmap_extension.patch deleted file mode 100644 index a1f46fa..0000000 --- a/kivy_ios/recipes/twisted/remove_portmap_extension.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- twisted-twisted-16.6.0/src/twisted/python/_setup.py 2016-11-17 09:10:00.000000000 +0100 -+++ twisted-twisted-16.6.0-patch/src/twisted/python/_setup.py 2018-06-02 08:05:51.000000000 +0100 -@@ -187,11 +187,6 @@ - sources=["src/twisted/python/_sendmsg.c"], - condition=lambda _: not _PY3 and sys.platform != "win32"), - -- ConditionalExtension( -- "twisted.runner.portmap", -- sources=["src/twisted/runner/portmap.c"], -- condition=lambda builder: not _PY3 and -- builder._check_header("rpc/rpc.h")), - ] - - diff --git a/kivy_ios/recipes/txjson-rpc/__init__.py b/kivy_ios/recipes/txjson-rpc/__init__.py deleted file mode 100644 index c1210f1..0000000 --- a/kivy_ios/recipes/txjson-rpc/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class TxJsonRpcRecipe(PythonRecipe): - version = "0.5" - url = "https://pypi.python.org/packages/source/t/txJSON-RPC/txJSON-RPC-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = TxJsonRpcRecipe() diff --git a/kivy_ios/recipes/txrequests/__init__.py b/kivy_ios/recipes/txrequests/__init__.py deleted file mode 100644 index 93a21b5..0000000 --- a/kivy_ios/recipes/txrequests/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class TxRequestsRecipe(PythonRecipe): - version = "0.9.5" - url = "https://pypi.python.org/packages/source/t/txrequests/txrequests-{version}.tar.gz" - depends = ["python", "setuptools", "requests", "twisted"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = TxRequestsRecipe() diff --git a/kivy_ios/recipes/wsgiref/__init__.py b/kivy_ios/recipes/wsgiref/__init__.py deleted file mode 100644 index 85ede68..0000000 --- a/kivy_ios/recipes/wsgiref/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class WsgiRefRecipe(PythonRecipe): - version = "0.1.2" - url = "https://pypi.python.org/packages/source/w/wsgiref/wsgiref-{version}.zip" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = WsgiRefRecipe() diff --git a/kivy_ios/recipes/yarl/__init__.py b/kivy_ios/recipes/yarl/__init__.py new file mode 100644 index 0000000..e68652f --- /dev/null +++ b/kivy_ios/recipes/yarl/__init__.py @@ -0,0 +1,22 @@ +# pure-python package, this can be removed when we'll support any python package +import os +import sh +from kivy_ios.toolchain import PythonRecipe, shprint + + +class YarlRecipe(PythonRecipe): + version = "1.3.0" + url = "https://pypi.python.org/packages/source/y/yarl/yarl-{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 = os.path.join(self.ctx.dist_dir, "root", "python3") + build_env['PYTHONPATH'] = os.path.join(dest_dir, 'lib', 'python3.8', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = YarlRecipe() diff --git a/kivy_ios/recipes/zbarlight/__init__.py b/kivy_ios/recipes/zbarlight/__init__.py index 4db31ea..22e0af0 100755 --- a/kivy_ios/recipes/zbarlight/__init__.py +++ b/kivy_ios/recipes/zbarlight/__init__.py @@ -16,7 +16,7 @@ class ZbarLightRecipe(Recipe): def get_zbar_env(self, arch): build_env = arch.get_env() - dest_dir = join(self.ctx.dist_dir, "root", "python") + dest_dir = join(self.ctx.dist_dir, "root", "python3") build_env["IOSROOT"] = self.ctx.root_dir build_env["IOSSDKROOT"] = arch.sysroot build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink") diff --git a/kivy_ios/recipes/zope_interface/__init__.py b/kivy_ios/recipes/zope_interface/__init__.py deleted file mode 100644 index b115b23..0000000 --- a/kivy_ios/recipes/zope_interface/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from toolchain import PythonRecipe, shprint -from os.path import join -import sh, os - -class ZopeInterfaceRecipe(PythonRecipe): - version = "4.5.0" - url = "https://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz" - depends = ["python", "setuptools"] - - 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") - build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) - -recipe = ZopeInterfaceRecipe() diff --git a/pybuilddir.txt b/pybuilddir.txt new file mode 100644 index 0000000..02446cf --- /dev/null +++ b/pybuilddir.txt @@ -0,0 +1 @@ +build/lib.ios-x86_64-3.7 \ No newline at end of file diff --git a/toolchain.py b/toolchain.py index 4791fc6..d28f12f 100644 --- a/toolchain.py +++ b/toolchain.py @@ -1,1571 +1,3 @@ from kivy_ios.toolchain import main -<<<<<<< HEAD -This tool intend to replace all the previous tools/ in shell script. -""" - -import sys -from sys import stdout -from os.path import join, dirname, realpath, exists, isdir, basename -from os import listdir, unlink, makedirs, environ, chdir, getcwd, walk, remove -import zipfile -import tarfile -import importlib -import io -import json -import shutil -import fnmatch -import tempfile -import time -from datetime import datetime -from pprint import pformat - -try: - from urllib.request import FancyURLopener, urlcleanup -except ImportError: - from urllib import FancyURLopener, urlcleanup - -try: - from pbxproj import XcodeProject - from pbxproj.pbxextensions.ProjectFiles import FileOptions -except ImportError: - print("ERROR: Python requirements are missing") - print("To install: pip install -r requirements.txt") - sys.exit(0) -curdir = dirname(__file__) -sys.path.insert(0, join(curdir, "tools", "external")) - -import sh - -import logging - -# For more detailed logging, use something like -# format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(funcName)s():%(lineno)d] %(message)s' -logging.basicConfig(format='[%(levelname)-8s] %(message)s', - datefmt='%Y-%m-%d:%H:%M:%S', - level=logging.DEBUG) - -# Quiet the loggers we don't care about -sh_logging = logging.getLogger('sh') -sh_logging.setLevel(logging.WARNING) - -logger = logging.getLogger(__name__) - - -IS_PY3 = sys.version_info[0] >= 3 -IS_PY2 = sys.version_info[0] == 2 - - -def shprint(command, *args, **kwargs): - kwargs["_iter"] = True - kwargs["_out_bufsize"] = 1 - kwargs["_err_to_out"] = True - logger.info("Running Shell: {} {} {}".format(str(command), args, kwargs)) - cmd = command(*args, **kwargs) - for line in cmd: - # strip only last CR: - line_str = "\n".join(line.encode("ascii", "replace").decode().splitlines()) - logger.debug(line_str) - -def cache_execution(f): - def _cache_execution(self, *args, **kwargs): - state = self.ctx.state - key = "{}.{}".format(self.name, f.__name__) - force = kwargs.pop("force", False) - if args: - for arg in args: - key += ".{}".format(arg) - if key in state and not force: - logger.debug("Cached result: {} {}. Ignoring".format(f.__name__.capitalize(), self.name)) - return - logger.info("{} {}".format(f.__name__.capitalize(), self.name)) - f(self, *args, **kwargs) - self.update_state(key, True) - return _cache_execution - -class ChromeDownloader(FancyURLopener): - version = ( - 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' - '(KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36') - -urlretrieve = ChromeDownloader().retrieve - - -class JsonStore(object): - """Replacement of shelve using json, needed for support python 2 and 3. - """ - - def __init__(self, filename): - super(JsonStore, self).__init__() - self.filename = filename - self.data = {} - if exists(filename): - try: - with io.open(filename, encoding='utf-8') as fd: - self.data = json.load(fd) - except ValueError: - logger.warning("Unable to read the state.db, content will be replaced.") - - def __getitem__(self, key): - return self.data[key] - - def __setitem__(self, key, value): - self.data[key] = value - self.sync() - - def __delitem__(self, key): - del self.data[key] - self.sync() - - def __contains__(self, item): - return item in self.data - - def get(self, item, default=None): - return self.data.get(item, default) - - def keys(self): - return self.data.keys() - - def remove_all(self, prefix): - for key in tuple(self.data.keys()): - if not key.startswith(prefix): - continue - del self.data[key] - self.sync() - - def sync(self): - # http://stackoverflow.com/questions/12309269/write-json-data-to-file-in-python/14870531#14870531 - if IS_PY3: - with open(self.filename, 'w') as fd: - json.dump(self.data, fd, ensure_ascii=False) - else: - with io.open(self.filename, 'w', encoding='utf-8') as fd: - fd.write(unicode(json.dumps(self.data, ensure_ascii=False))) - -class Arch(object): - def __init__(self, ctx): - super(Arch, self).__init__() - self.ctx = ctx - self._ccsh = None - - def __str__(self): - return self.arch - - @property - def include_dirs(self): - return [ - "{}/{}".format( - self.ctx.include_dir, - d.format(arch=self)) - for d in self.ctx.include_dirs] - - - def get_env(self): - include_dirs = [ - "-I{}/{}".format( - self.ctx.include_dir, - d.format(arch=self)) - for d in self.ctx.include_dirs] - include_dirs += ["-I{}".format( - join(self.ctx.dist_dir, "include", self.arch))] - - env = {} - cc = sh.xcrun("-find", "-sdk", self.sdk, "clang").strip() - cxx = sh.xcrun("-find", "-sdk", self.sdk, "clang++").strip() - - # we put the flags in CC / CXX as sometimes the ./configure test - # with the preprocessor (aka CC -E) without CFLAGS, which fails for - # cross compiled projects - flags = " ".join([ - "--sysroot", self.sysroot, - "-arch", self.arch, - "-pipe", "-no-cpp-precomp", - ]) - cc += " " + flags - cxx += " " + flags - - use_ccache = environ.get("USE_CCACHE", "1") - ccache = None - if use_ccache == "1": - ccache = sh.which('ccache') - if ccache: - ccache = ccache.strip() - env["USE_CCACHE"] = "1" - env["CCACHE"] = ccache - env.update({k: v for k, v in environ.items() if k.startswith('CCACHE_')}) - env.setdefault('CCACHE_MAXSIZE', '10G') - env.setdefault('CCACHE_HARDLINK', 'true') - env.setdefault('CCACHE_SLOPPINESS', ('file_macro,time_macros,' - 'include_file_mtime,include_file_ctime,file_stat_matches')) - - if not self._ccsh: - self._ccsh = tempfile.NamedTemporaryFile() - self._cxxsh = tempfile.NamedTemporaryFile() - sh.chmod("+x", self._ccsh.name) - sh.chmod("+x", self._cxxsh.name) - self._ccsh.write(b'#!/bin/sh\n') - self._cxxsh.write(b'#!/bin/sh\n') - if ccache: - logger.info("CC and CXX will use ccache") - self._ccsh.write( - (ccache + ' ' + cc + ' "$@"\n').encode("utf8")) - self._cxxsh.write( - (ccache + ' ' + cxx + ' "$@"\n').encode("utf8")) - else: - logger.info("CC and CXX will not use ccache") - self._ccsh.write( - (cc + ' "$@"\n').encode("utf8")) - self._cxxsh.write( - (cxx + ' "$@"\n').encode("utf8")) - self._ccsh.flush() - self._cxxsh.flush() - - env["CC"] = self._ccsh.name - env["CXX"] = self._cxxsh.name - env["AR"] = sh.xcrun("-find", "-sdk", self.sdk, "ar").strip() - env["LD"] = sh.xcrun("-find", "-sdk", self.sdk, "ld").strip() - env["OTHER_CFLAGS"] = " ".join(include_dirs) - env["OTHER_LDFLAGS"] = " ".join([ - "-L{}/{}".format(self.ctx.dist_dir, "lib"), - ]) - env["CFLAGS"] = " ".join([ - "-O3", - self.version_min - ] + include_dirs) - env["LDFLAGS"] = " ".join([ - "-arch", self.arch, - "--sysroot", self.sysroot, - "-L{}/{}".format(self.ctx.dist_dir, "lib"), - "-lsqlite3", - self.version_min - ]) - return env - - -class Arch64Simulator(Arch): - sdk = "iphonesimulator" - arch = "x86_64" - triple = "x86_64-apple-darwin13" - version_min = "-miphoneos-version-min=8.0" - sysroot = sh.xcrun("--sdk", "iphonesimulator", "--show-sdk-path").strip() - - -class Arch64IOS(Arch): - sdk = "iphoneos" - arch = "arm64" - triple = "aarch64-apple-darwin13" - version_min = "-miphoneos-version-min=8.0" - sysroot = sh.xcrun("--sdk", "iphoneos", "--show-sdk-path").strip() - - -class Graph(object): - # Taken from python-for-android/depsort - def __init__(self): - # `graph`: dict that maps each package to a set of its dependencies. - self.graph = {} - - def add(self, dependent, dependency): - """Add a dependency relationship to the graph""" - self.graph.setdefault(dependent, set()) - self.graph.setdefault(dependency, set()) - if dependent != dependency: - self.graph[dependent].add(dependency) - - def add_optional(self, dependent, dependency): - """Add an optional (ordering only) dependency relationship to the graph - - Only call this after all mandatory requirements are added - """ - if dependent in self.graph and dependency in self.graph: - self.add(dependent, dependency) - - def find_order(self): - """Do a topological sort on a dependency graph - - :Parameters: - :Returns: - iterator, sorted items form first to last - """ - graph = dict((k, set(v)) for k, v in self.graph.items()) - while graph: - # Find all items without a parent - leftmost = [l for l, s in graph.items() if not s] - if not leftmost: - raise ValueError('Dependency cycle detected! %s' % graph) - # If there is more than one, sort them for predictable order - leftmost.sort() - for result in leftmost: - # Yield and remove them from the graph - yield result - graph.pop(result) - for bset in graph.values(): - bset.discard(result) - - -class Context(object): - env = environ.copy() - root_dir = None - cache_dir = None - build_dir = None - dist_dir = None - install_dir = None - ccache = None - cython = None - sdkver = None - sdksimver = None - so_suffix = None # set by one of the hostpython - - def __init__(self): - super(Context, self).__init__() - self.include_dirs = [] - - ok = True - - sdks = sh.xcodebuild("-showsdks").splitlines() - - # get the latest iphoneos - iphoneos = [x for x in sdks if "iphoneos" in x] - if not iphoneos: - logger.error("No iphone SDK installed") - ok = False - else: - iphoneos = iphoneos[0].split()[-1].replace("iphoneos", "") - self.sdkver = iphoneos - - # get the latest iphonesimulator version - iphonesim = [x for x in sdks if "iphonesimulator" in x] - if not iphonesim: - ok = False - logger.error("Error: No iphonesimulator SDK installed") - else: - iphonesim = iphonesim[0].split()[-1].replace("iphonesimulator", "") - self.sdksimver = iphonesim - - # get the path for Developer - self.devroot = "{}/Platforms/iPhoneOS.platform/Developer".format( - sh.xcode_select("-print-path").strip()) - - # path to the iOS SDK - self.iossdkroot = "{}/SDKs/iPhoneOS{}.sdk".format( - self.devroot, self.sdkver) - - # root of the toolchain - self.root_dir = realpath(dirname(__file__)) - self.build_dir = "{}/build".format(self.root_dir) - self.cache_dir = "{}/.cache".format(self.root_dir) - self.dist_dir = "{}/dist".format(self.root_dir) - self.install_dir = "{}/dist/root".format(self.root_dir) - self.include_dir = "{}/dist/include".format(self.root_dir) - self.archs = ( - Arch64Simulator(self), - Arch64IOS(self)) - - # path to some tools - self.ccache = sh.which("ccache") - if not self.ccache: - #print("ccache is missing, the build will not be optimized in the future.") - pass - for cython_fn in ("cython-2.7", "cython"): - cython = sh.which(cython_fn) - if cython: - self.cython = cython - break - if not self.cython: - ok = False - logger.error("Missing requirement: cython is not installed") - - # check the basic tools - for tool in ("pkg-config", "autoconf", "automake", "libtool"): - if not sh.which(tool): - logger.error("Missing requirement: {} is not installed".format( - tool)) - - if not ok: - sys.exit(1) - - self.use_pigz = sh.which('pigz') - self.use_pbzip2 = sh.which('pbzip2') - - try: - num_cores = int(sh.sysctl('-n', 'hw.ncpu')) - except Exception: - num_cores = None - self.num_cores = num_cores if num_cores else 4 # default to 4 if we can't detect - - ensure_dir(self.root_dir) - ensure_dir(self.build_dir) - ensure_dir(self.cache_dir) - ensure_dir(self.dist_dir) - ensure_dir(self.install_dir) - ensure_dir(self.include_dir) - ensure_dir(join(self.include_dir, "common")) - - # remove the most obvious flags that can break the compilation - self.env.pop("MACOSX_DEPLOYMENT_TARGET", None) - self.env.pop("PYTHONDONTWRITEBYTECODE", None) - self.env.pop("ARCHFLAGS", None) - self.env.pop("CFLAGS", None) - self.env.pop("LDFLAGS", None) - - # set the state - self.state = JsonStore(join(self.dist_dir, "state.db")) - - @property - def concurrent_make(self): - return "-j{}".format(self.num_cores) - - @property - def concurrent_xcodebuild(self): - return "IDEBuildOperationMaxNumberOfConcurrentCompileTasks={}".format(self.num_cores) - - - -class Recipe(object): - props = { - "is_alias": False, - "version": None, - "url": None, - "archs": [], - "depends": [], - "optional_depends": [], - "library": None, - "libraries": [], - "include_dir": None, - "include_per_arch": False, - "include_name": None, - "frameworks": [], - "sources": [], - "pbx_frameworks": [], - "pbx_libraries": [] - } - - def __new__(cls): - for prop, value in cls.props.items(): - if not hasattr(cls, prop): - setattr(cls, prop, value) - return super(Recipe, cls).__new__(cls) - - # API available for recipes - def download_file(self, url, filename, cwd=None): - """ - Download an `url` to `outfn` - """ - if not url: - return - def report_hook(index, blksize, size): - if size <= 0: - progression = '{0} bytes'.format(index * blksize) - else: - progression = '{0:.2f}%'.format( - index * blksize * 100. / float(size)) - stdout.write('- Download {}\r'.format(progression)) - stdout.flush() - - if cwd: - filename = join(cwd, filename) - if exists(filename): - unlink(filename) - - # Clean up temporary files just in case before downloading. - urlcleanup() - - logger.info('Downloading {0}'.format(url)) - attempts = 0 - while True: - try: - urlretrieve(url, filename, report_hook) - except AttributeError: - if IS_PY2: - # This is caused by bug in python-future, causing occasional - # AttributeError: '_fileobject' object has no attribute 'readinto' - # It can be removed if the upstream fix is accepted. See also: - # * https://github.com/kivy/kivy-ios/issues/322 - # * https://github.com/PythonCharmers/python-future/pull/423 - import requests - - logger.warning("urlretrieve failed. Falling back to request") - - headers = {'User-agent': 'Mozilla/5.0 (X11; Linux x86_64) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) ' - 'Chrome/28.0.1500.71 Safari/537.36'} - r = requests.get(url, headers=headers) - - with open(filename, "wb") as fw: - fw.write(r.content) - break - else: - raise - except OSError as e: - attempts += 1 - if attempts >= 5: - logger.error('Max download attempts reached: {}'.format(attempts)) - raise e - logger.warning('Download failed. Retrying in 1 second...') - time.sleep(1) - continue - break - - return filename - - def extract_file(self, filename, cwd): - """ - Extract the `filename` into the directory `cwd`. - """ - if not filename: - return - logger.info("Extract {} into {}".format(filename, cwd)) - if filename.endswith(".tgz") or filename.endswith(".tar.gz"): - if self.ctx.use_pigz: - comp = '--use-compress-program={}'.format(self.ctx.use_pigz) - else: - comp = '-z' - shprint(sh.tar, "-C", cwd, "-xv", comp, "-f", filename) - - elif filename.endswith(".tbz2") or filename.endswith(".tar.bz2"): - if self.ctx.use_pbzip2: - comp = '--use-compress-program={}'.format(self.ctx.use_pbzip2) - else: - comp = '-j' - shprint(sh.tar, "-C", cwd, "-xv", comp, "-f", filename) - - elif filename.endswith(".zip"): - shprint(sh.unzip, "-d", cwd, filename) - - else: - logger.error("Cannot extract, unrecognized extension for {}".format( - filename)) - raise Exception() - - def get_archive_rootdir(self, filename): - if filename.endswith(".tgz") or filename.endswith(".tar.gz") or \ - filename.endswith(".tbz2") or filename.endswith(".tar.bz2"): - try: - archive = tarfile.open(filename) - except tarfile.ReadError: - logger.warning('Error extracting the archive {0}'.format(filename)) - logger.warning('This is usually caused by a corrupt download. The file' - ' will be removed and re-downloaded on the next run.') - logger.warning(filename) - return - - root = archive.next().path.split("/") - return root[0] - elif filename.endswith(".zip"): - with zipfile.ZipFile(filename) as zf: - return dirname(zf.namelist()[0]) - else: - logger.error("Unrecognized extension for {}." - " Cannot detect root directory".format(filename)) - raise Exception() - - def apply_patch(self, filename, target_dir=''): - """ - Apply a patch from the current recipe directory into the current - build directory. - """ - target_dir = target_dir or self.build_dir - logger.info("Apply patch {}".format(filename)) - filename = join(self.recipe_dir, filename) - sh.patch("-t", "-d", target_dir, "-p1", "-i", filename) - - def copy_file(self, filename, dest): - logger.info("Copy {} to {}".format(filename, dest)) - filename = join(self.recipe_dir, filename) - dest = join(self.build_dir, dest) - shutil.copy(filename, dest) - - def append_file(self, filename, dest): - logger.info("Append {} to {}".format(filename, dest)) - filename = join(self.recipe_dir, filename) - dest = join(self.build_dir, dest) - with open(filename, "rb") as fd: - data = fd.read() - with open(dest, "ab") as fd: - fd.write(data) - - def has_marker(self, marker): - """ - Return True if the current build directory has the marker set - """ - return exists(join(self.build_dir, ".{}".format(marker))) - - def set_marker(self, marker): - """ - Set a marker info the current build directory - """ - with open(join(self.build_dir, ".{}".format(marker)), "w") as fd: - fd.write("ok") - - def delete_marker(self, marker): - """ - Delete a specific marker - """ - try: - unlink(join(self.build_dir, ".{}".format(marker))) - except: - pass - - def get_include_dir(self): - """ - Return the common include dir for this recipe - """ - return join(self.ctx.include_dir, "common", self.name) - - def so_filename(self, name): - """Return the filename of a library with the appropriate so suffix - (.so for Python 2.7, .cpython-37m-darwin for Python 3.7) - """ - return "{}{}".format(name, self.ctx.so_suffix) - - @property - def name(self): - modname = self.__class__.__module__ - return modname.split(".", 1)[-1] - - @property - def archive_fn(self): - bfn = basename(self.url.format(version=self.version)) - fn = "{}/{}-{}".format( - self.ctx.cache_dir, - self.name, bfn) - return fn - - @property - def filtered_archs(self): - result = [] - for arch in self.ctx.archs: - if not self.archs or (arch.arch in self.archs): - result.append(arch) - return result - - @property - def dist_libraries(self): - libraries = [] - name = self.name - if not name.startswith("lib"): - name = "lib{}".format(name) - if self.library: - static_fn = join(self.ctx.dist_dir, "lib", "{}.a".format(name)) - libraries.append(static_fn) - for library in self.libraries: - static_fn = join(self.ctx.dist_dir, "lib", basename(library)) - libraries.append(static_fn) - return libraries - - def get_build_dir(self, arch): - return join(self.ctx.build_dir, self.name, arch, self.archive_root) - - # Public Recipe API to be subclassed if needed - - def init_with_ctx(self, ctx): - self.ctx = ctx - include_dir = None - if self.include_dir: - include_name = self.include_name or self.name - if self.include_per_arch: - include_dir = join("{arch.arch}", include_name) - else: - include_dir = join("common", include_name) - if include_dir: - logger.info("Include dir added: {}".format(include_dir)) - self.ctx.include_dirs.append(include_dir) - - def get_recipe_env(self, arch=None): - """Return the env specialized for the recipe - """ - if arch is None: - arch = self.filtered_archs[0] - return arch.get_env() - - def set_hostpython(self, instance, version): - state = self.ctx.state - hostpython = state.get("hostpython") - if hostpython is None: - state["hostpython"] = instance.name - state.sync() - elif hostpython != instance.name: - logger.error("Wanted to use {}".format(instance.name)) - logger.error("but hostpython is already provided by {}.".format( - hostpython)) - logger.error("You can have only one hostpython version compiled") - sys.exit(1) - self.ctx.python_major = version.split('.')[0] - self.ctx.hostpython_ver = version - self.ctx.hostpython_recipe = instance - - def set_python(self, instance, version): - state = self.ctx.state - python = state.get("python") - if python is None: - state["python"] = instance.name - state.sync() - elif python != instance.name: - logger.error("Wanted to use {}".format(instance.name)) - logger.error("but python is already provided by {}.".format( - python)) - logger.error("You can have only one python version compiled") - sys.exit(1) - self.ctx.python_ver = version - self.ctx.python_recipe = instance - - @property - def archive_root(self): - key = "{}.archive_root".format(self.name) - value = self.ctx.state.get(key) - if not value: - value = self.get_archive_rootdir(self.archive_fn) - if value is not None: - self.ctx.state[key] = value - return value - - def execute(self): - if self.custom_dir: - self.ctx.state.remove_all(self.name) - self.download() - self.extract() - self.build_all() - - @property - def custom_dir(self): - """Check if there is a variable name to specify a custom version / - directory to use instead of the current url. - """ - envname = "{}_DIR".format(self.name.upper()) - d = environ.get(envname) - if not d: - return - if not exists(d): - raise ValueError("Invalid path passed into {}".format(envname)) - return d - - def init_after_import(cls, ctx): - """This can be used to dynamically set some variables - depending of the state - """ - pass - - @cache_execution - def download(self): - key = "{}.archive_root".format(self.name) - if self.custom_dir: - self.ctx.state[key] = basename(self.custom_dir) - else: - src_dir = join(self.recipe_dir, self.url) - if exists(src_dir): - self.ctx.state[key] = basename(src_dir) - return - fn = self.archive_fn - if not exists(fn): - self.download_file(self.url.format(version=self.version), fn) - status = self.get_archive_rootdir(self.archive_fn) - if status is not None: - self.ctx.state[key] = status - - @cache_execution - def extract(self): - # recipe tmp directory - for arch in self.filtered_archs: - logger.info("Extract {} for {}".format(self.name, arch.arch)) - self.extract_arch(arch.arch) - - def extract_arch(self, arch): - build_dir = join(self.ctx.build_dir, self.name, arch) - dest_dir = join(build_dir, self.archive_root) - if self.custom_dir: - if exists(dest_dir): - shutil.rmtree(dest_dir) - shutil.copytree(self.custom_dir, dest_dir) - else: - if exists(dest_dir): - return - src_dir = join(self.recipe_dir, self.url) - if exists(src_dir): - shutil.copytree(src_dir, dest_dir) - return - ensure_dir(build_dir) - self.extract_file(self.archive_fn, build_dir) - - @cache_execution - def build(self, arch): - self.build_dir = self.get_build_dir(arch.arch) - if self.has_marker("building"): - logger.warning("{} build for {} has been incomplete".format( - self.name, arch.arch)) - logger.warning("Warning: deleting the build and restarting.") - shutil.rmtree(self.build_dir) - self.extract_arch(arch.arch) - - if self.has_marker("build_done"): - logger.info("Build python for {} already done.".format(arch.arch)) - return - - self.set_marker("building") - - chdir(self.build_dir) - logger.info("Prebuild {} for {}".format(self.name, arch.arch)) - self.prebuild_arch(arch) - logger.info("Build {} for {}".format(self.name, arch.arch)) - self.build_arch(arch) - logger.info("Postbuild {} for {}".format(self.name, arch.arch)) - self.postbuild_arch(arch) - self.delete_marker("building") - self.set_marker("build_done") - - def update_state(self, key, value): - """Update entry in state database - - This is usually done in the @cache_execution decorator - to log an action and its time of occurrence, - but it needs to be done manually in recipes. - - sets key = value, and key.at = current_datetime - """ - key_time = "{}.at".format(key) - self.ctx.state[key] = value - self.ctx.state[key_time] = str(datetime.utcnow()) - - @cache_execution - def build_all(self): - filtered_archs = self.filtered_archs - logger.info("Build {} for {} (filtered)".format( - self.name, - ", ".join([x.arch for x in filtered_archs]))) - for arch in self.filtered_archs: - self.build(arch) - - name = self.name - if self.library: - logger.info("Create lipo library for {}".format(name)) - if not name.startswith("lib"): - name = "lib{}".format(name) - static_fn = join(self.ctx.dist_dir, "lib", "{}.a".format(name)) - ensure_dir(dirname(static_fn)) - logger.info("Lipo {} to {}".format(self.name, static_fn)) - self.make_lipo(static_fn) - if self.libraries: - logger.info("Create multiple lipo for {}".format(name)) - for library in self.libraries: - static_fn = join(self.ctx.dist_dir, "lib", basename(library)) - ensure_dir(dirname(static_fn)) - logger.info(" - Lipo-ize {}".format(library)) - self.make_lipo(static_fn, library) - logger.info("Install include files for {}".format(self.name)) - self.install_include() - logger.info("Install frameworks for {}".format(self.name)) - self.install_frameworks() - logger.info("Install sources for {}".format(self.name)) - self.install_sources() - logger.info("Install {}".format(self.name)) - self.install() - - def prebuild_arch(self, arch): - prebuild = "prebuild_{}".format(arch.arch) - logger.debug("Invoking {}".format(prebuild)) - if hasattr(self, prebuild): - getattr(self, prebuild)() - - def build_arch(self, arch): - build = "build_{}".format(arch.arch) - logger.debug("Invoking {}".format(build)) - if hasattr(self, build): - getattr(self, build)() - - def postbuild_arch(self, arch): - postbuild = "postbuild_{}".format(arch.arch) - logger.debug("Invoking {}".format(postbuild)) - if hasattr(self, postbuild): - getattr(self, postbuild)() - - def update_state(self, key, value): - """Update entry in state database - - Also adds the time of update - """ - key_time = "{}.at".format(key) - self.ctx.state[key] = value - now_str = str(datetime.utcnow()) - self.ctx.state[key_time] = now_str - logger.debug("New State: {} at {}".format(key, now_str)) - - @cache_execution - def make_lipo(self, filename, library=None): - if library is None: - library = self.library - if not library: - return - args = [] - for arch in self.filtered_archs: - library_fn = library.format(arch=arch) - args += [ - "-arch", arch.arch, - join(self.get_build_dir(arch.arch), library_fn)] - shprint(sh.lipo, "-create", "-output", filename, *args) - - @cache_execution - def install_frameworks(self): - if not self.frameworks: - return - arch = self.filtered_archs[0] - build_dir = self.get_build_dir(arch.arch) - for framework in self.frameworks: - logger.info("Install Framework {}".format(framework)) - src = join(build_dir, framework) - dest = join(self.ctx.dist_dir, "frameworks", framework) - ensure_dir(dirname(dest)) - if exists(dest): - shutil.rmtree(dest) - logger.debug("Copy {} to {}".format(src, dest)) - shutil.copytree(src, dest) - - @cache_execution - def install_sources(self): - if not self.sources: - return - arch = self.filtered_archs[0] - build_dir = self.get_build_dir(arch.arch) - for source in self.sources: - logger.info("Install Sources{}".format(source)) - src = join(build_dir, source) - dest = join(self.ctx.dist_dir, "sources", self.name) - ensure_dir(dirname(dest)) - if exists(dest): - shutil.rmtree(dest) - logger.debug("Copy {} to {}".format(src, dest)) - shutil.copytree(src, dest) - - @cache_execution - def install_include(self): - if not self.include_dir: - return - if self.include_per_arch: - archs = self.ctx.archs - else: - archs = self.filtered_archs[:1] - - include_dirs = self.include_dir - if not isinstance(include_dirs, (list, tuple)): - include_dirs = list([include_dirs]) - - for arch in archs: - arch_dir = "common" - if self.include_per_arch: - arch_dir = arch.arch - include_name = self.include_name or self.name - dest_dir = join(self.ctx.include_dir, arch_dir, include_name) - if exists(dest_dir): - shutil.rmtree(dest_dir) - build_dir = self.get_build_dir(arch.arch) - - for include_dir in include_dirs: - dest_name = None - if isinstance(include_dir, (list, tuple)): - include_dir, dest_name = include_dir - include_dir = include_dir.format(arch=arch, ctx=self.ctx) - src_dir = join(build_dir, include_dir) - if dest_name is None: - dest_name = basename(src_dir) - if isdir(src_dir): - shutil.copytree(src_dir, dest_dir) - else: - dest = join(dest_dir, dest_name) - logger.info("Copy Include {} to {}".format(src_dir, dest)) - ensure_dir(dirname(dest)) - shutil.copy(src_dir, dest) - - @cache_execution - def install(self): - pass - - @classmethod - def list_recipes(cls, **kwargs): - skip_list = kwargs.pop("skip_list", ['__pycache__']) - recipes_dir = join(dirname(__file__), "recipes") - for name in sorted(listdir(recipes_dir)): - fn = join(recipes_dir, name) - if isdir(fn) and name not in skip_list: - yield name - - @classmethod - def get_recipe(cls, name, ctx): - if not hasattr(cls, "recipes"): - cls.recipes = {} - - if '==' in name: - name, version = name.split('==') - else: - version = None - - if name in cls.recipes: - recipe = cls.recipes[name] - else: - mod = importlib.import_module("recipes.{}".format(name)) - recipe = mod.recipe - recipe.recipe_dir = join(ctx.root_dir, "recipes", name) - recipe.init_after_import(ctx) - - if version: - recipe.version = version - - return recipe - - -class PythonRecipe(Recipe): - @cache_execution - def install(self): - self.install_python_package() - self.reduce_python_package() - - @staticmethod - def remove_junk(d): - exts = [".pyc", ".py", ".so.lib", ".so.o", ".sh"] - for root, dirnames, filenames in walk(d): - for fn in filenames: - if any([fn.endswith(ext) for ext in exts]): - unlink(join(root, fn)) - - def install_python_package(self, name=None, env=None, is_dir=True): - """Automate the installation of a Python package into the target - site-packages. - - It will works with the first filtered_archs, and the name of the recipe. - """ - arch = self.filtered_archs[0] - if name is None: - name = self.name - if env is None: - env = self.get_recipe_env(arch) - logger.info("Install {} into the site-packages".format(name)) - build_dir = self.get_build_dir(arch.arch) - chdir(build_dir) - hostpython = sh.Command(self.ctx.hostpython) - iosbuild = join(build_dir, "iosbuild") - shprint(hostpython, "setup.py", "install", "-O2", - "--prefix", iosbuild, - _env=env) - dest_dir = join(self.ctx.site_packages_dir, name) - #self.remove_junk(iosbuild) - if is_dir: - if exists(dest_dir): - shutil.rmtree(dest_dir) - func = shutil.copytree - else: - func = shutil.copy - func( - join(iosbuild, "lib", - self.ctx.python_ver_dir, "site-packages", name), - dest_dir) - - def reduce_python_package(self): - """Feel free to remove things you don't want in the final - site-packages. - """ - pass - - -class CythonRecipe(PythonRecipe): - pre_build_ext = False - cythonize = True - - def cythonize_file(self, filename): - if filename.startswith(self.build_dir): - filename = filename[len(self.build_dir) + 1:] - logger.info("Cythonize {}".format(filename)) - cmd = sh.Command(join(self.ctx.root_dir, "tools", "cythonize.py")) - hostpython = self.ctx.state.get("hostpython") - shprint(cmd, filename) - - def cythonize_build(self): - if not self.cythonize: - return - root_dir = self.build_dir - for root, dirnames, filenames in walk(root_dir): - for filename in fnmatch.filter(filenames, "*.pyx"): - self.cythonize_file(join(root, filename)) - - def biglink(self): - dirs = [] - for root, dirnames, filenames in walk(self.build_dir): - if fnmatch.filter(filenames, "*.so.libs"): - dirs.append(root) - cmd = sh.Command(join(self.ctx.root_dir, "tools", "biglink")) - shprint(cmd, join(self.build_dir, "lib{}.a".format(self.name)), *dirs) - - def get_recipe_env(self, arch): - env = super(CythonRecipe, self).get_recipe_env(arch) - env["KIVYIOSROOT"] = self.ctx.root_dir - env["IOSSDKROOT"] = arch.sysroot - env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink") - env["ARM_LD"] = env["LD"] - env["ARCH"] = arch.arch - env["PYTHONPATH"] = dirname(realpath(__file__)) - return env - - def build_arch(self, arch): - build_env = self.get_recipe_env(arch) - hostpython = sh.Command(self.ctx.hostpython) - if self.pre_build_ext: - try: - shprint(hostpython, "setup.py", "build_ext", "-g", - _env=build_env) - except: - pass - self.cythonize_build() - shprint(hostpython, "setup.py", "build_ext", "-g", - _env=build_env) - self.biglink() - - -def build_recipes(names, ctx): - # gather all the dependencies - logger.info("Want to build {}".format(names)) - graph = Graph() - ctx.wanted_recipes = names[:] - recipe_to_load = names - recipe_loaded = [] - while names: - name = recipe_to_load.pop(0) - if name in recipe_loaded: - continue - try: - recipe = Recipe.get_recipe(name, ctx) - except ImportError: - logger.error("No recipe named {}".format(name)) - sys.exit(1) - graph.add(name, name) - logger.info("Loaded recipe {} (depends of {}, optional are {})".format(name, - recipe.depends, recipe.optional_depends)) - for depend in recipe.depends: - graph.add(name, depend) - recipe_to_load += recipe.depends - for depend in recipe.optional_depends: - # in case of compilation after the initial one, take in account - # of the already compiled recipes - key = "{}.build_all".format(depend) - if key in ctx.state: - recipe_to_load.append(name) - graph.add(name, depend) - else: - graph.add_optional(name, depend) - recipe_loaded.append(name) - - build_order = list(graph.find_order()) - logger.info("Build order is {}".format(build_order)) - recipes = [Recipe.get_recipe(name, ctx) for name in build_order] - recipes = [recipe for recipe in recipes if not recipe.is_alias] - recipes_order = [recipe.name for recipe in recipes] - logger.info("Recipe order is {}".format(recipes_order)) - for recipe in recipes: - recipe.init_with_ctx(ctx) - for recipe in recipes: - recipe.execute() - - -def ensure_dir(filename): - if not exists(filename): - makedirs(filename) - - -def ensure_recipes_loaded(ctx): - for recipe in Recipe.list_recipes(): - key = "{}.build_all".format(recipe) - if key not in ctx.state: - continue - recipe = Recipe.get_recipe(recipe, ctx) - recipe.init_with_ctx(ctx) - - -def update_pbxproj(filename, pbx_frameworks=None): - # list all the compiled recipes - ctx = Context() - pbx_libraries = [] - if pbx_frameworks is None: - pbx_frameworks = [] - frameworks = [] - libraries = [] - sources = [] - for recipe in Recipe.list_recipes(): - key = "{}.build_all".format(recipe) - if key not in ctx.state: - continue - recipe = Recipe.get_recipe(recipe, ctx) - recipe.init_with_ctx(ctx) - pbx_frameworks.extend(recipe.pbx_frameworks) - pbx_libraries.extend(recipe.pbx_libraries) - libraries.extend(recipe.dist_libraries) - frameworks.extend(recipe.frameworks) - if recipe.sources: - sources.append(recipe.name) - - pbx_frameworks = list(set(pbx_frameworks)) - pbx_libraries = list(set(pbx_libraries)) - libraries = list(set(libraries)) - - logger.info("-" * 70) - logger.info("The project need to have:") - logger.info("iOS Frameworks: {}".format(pbx_frameworks)) - logger.info("iOS Libraries: {}".format(pbx_libraries)) - logger.info("iOS local Frameworks: {}".format(frameworks)) - logger.info("Libraries: {}".format(libraries)) - logger.info("Sources to link: {}".format(sources)) - - logger.info("-" * 70) - logger.info("Analysis of {}".format(filename)) - - project = XcodeProject.load(filename) - sysroot = sh.xcrun("--sdk", "iphonesimulator", "--show-sdk-path").strip() - - group = project.get_or_create_group("Frameworks") - g_classes = project.get_or_create_group("Classes") - file_options = FileOptions(embed_framework=False, code_sign_on_copy=True) - for framework in pbx_frameworks: - framework_name = "{}.framework".format(framework) - if framework_name in frameworks: - logger.info("Ensure {} is in the project (pbx_frameworks, local)".format(framework)) - f_path = join(ctx.dist_dir, "frameworks", framework_name) - else: - logger.info("Ensure {} is in the project (pbx_frameworks, system)".format(framework)) - f_path = join(sysroot, "System", "Library", "Frameworks", - "{}.framework".format(framework)) - project.add_file(f_path, parent=group, tree="DEVELOPER_DIR", - force=False, file_options=file_options) - for library in pbx_libraries: - logger.info("Ensure {} is in the project (pbx_libraries, dylib+tbd)".format(library)) - f_path = join(sysroot, "usr", "lib", - "{}.dylib".format(library)) - project.add_file(f_path, parent=group, tree="DEVELOPER_DIR", force=False) - f_path = join(sysroot, "usr", "lib", - "{}.tbd".format(library)) - project.add_file(f_path, parent=group, tree="DEVELOPER_DIR", force=False) - for library in libraries: - logger.info("Ensure {} is in the project (libraries)".format(library)) - project.add_file(library, parent=group, force=False) - for name in sources: - logger.info("Ensure {} sources are used".format(name)) - fn = join(ctx.dist_dir, "sources", name) - project.add_folder(fn, parent=g_classes) - - - project.backup() - project.save() - - -if __name__ == "__main__": - import argparse - - class ToolchainCL(object): - def __init__(self): - parser = argparse.ArgumentParser( - description="Tool for managing the iOS / Python toolchain", - usage="""toolchain <command> [<args>] - -Available commands: - build Build a recipe (compile a library for the required target - architecture) - clean Clean the build of the specified recipe - distclean Clean the build and the result - recipes List all the available recipes - status List all the recipes and their build status - build_info Display the current build context and Architecture info - -Xcode: - create Create a new xcode project - update Update an existing xcode project (frameworks, libraries..) - launchimage Create Launch images for your xcode project - icon Create Icons for your xcode project - pip Install a pip dependency into the distribution -""") - parser.add_argument("command", help="Command to run") - args = parser.parse_args(sys.argv[1:2]) - if not hasattr(self, args.command): - print('Unrecognized command') - parser.print_help() - exit(1) - getattr(self, args.command)() - - def build(self): - ctx = Context() - parser = argparse.ArgumentParser( - description="Build the toolchain") - parser.add_argument("recipe", nargs="+", help="Recipe to compile") - parser.add_argument("--arch", action="append", - help="Restrict compilation to this arch") - parser.add_argument("--concurrency", type=int, default=ctx.num_cores, - help="number of concurrent build processes (where supported)") - parser.add_argument("--no-pigz", action="store_true", default=not bool(ctx.use_pigz), - help="do not use pigz for gzip decompression") - parser.add_argument("--no-pbzip2", action="store_true", default=not bool(ctx.use_pbzip2), - help="do not use pbzip2 for bzip2 decompression") - args = parser.parse_args(sys.argv[2:]) - - if args.arch: - if len(args.arch) == 1: - archs = args.arch[0].split() - else: - archs = args.arch - available_archs = [arch.arch for arch in ctx.archs] - for arch in archs[:]: - if arch not in available_archs: - logger.error("Architecture {} invalid".format(arch)) - archs.remove(arch) - continue - ctx.archs = [arch for arch in ctx.archs if arch.arch in archs] - logger.info("Architectures restricted to: {}".format(archs)) - ctx.num_cores = args.concurrency - if args.no_pigz: - ctx.use_pigz = False - if args.no_pbzip2: - ctx.use_pbzip2 = False - ctx.use_pigz = ctx.use_pbzip2 - logger.info("Building with {} processes, where supported".format(ctx.num_cores)) - if ctx.use_pigz: - logger.info("Using pigz to decompress gzip data") - if ctx.use_pbzip2: - logger.info("Using pbzip2 to decompress bzip2 data") - build_recipes(args.recipe, ctx) - - def recipes(self): - parser = argparse.ArgumentParser( - description="List all the available recipes") - parser.add_argument( - "--compact", action="store_true", - help="Produce a compact list suitable for scripting") - args = parser.parse_args(sys.argv[2:]) - - if args.compact: - print(" ".join(list(Recipe.list_recipes()))) - else: - ctx = Context() - for name in Recipe.list_recipes(): - try: - recipe = Recipe.get_recipe(name, ctx) - print("{recipe.name:<12} {recipe.version:<8}".format(recipe=recipe)) - - except: - pass - - def clean(self): - parser = argparse.ArgumentParser( - description="Clean the build") - parser.add_argument("recipe", nargs="*", help="Recipe to clean") - args = parser.parse_args(sys.argv[2:]) - ctx = Context() - if args.recipe: - for recipe in args.recipe: - logger.info("Cleaning {} build".format(recipe)) - ctx.state.remove_all("{}.".format(recipe)) - build_dir = join(ctx.build_dir, recipe) - if exists(build_dir): - shutil.rmtree(build_dir) - else: - logger.info("Delete build directory") - if exists(ctx.build_dir): - shutil.rmtree(ctx.build_dir) - - def distclean(self): - parser = argparse.ArgumentParser( - description="Clean the build, download, and dist") - args = parser.parse_args(sys.argv[2:]) - ctx = Context() - if exists(ctx.build_dir): - shutil.rmtree(ctx.build_dir) - if exists(ctx.dist_dir): - shutil.rmtree(ctx.dist_dir) - if exists(ctx.cache_dir): - shutil.rmtree(ctx.cache_dir) - - def status(self): - parser = argparse.ArgumentParser( - description="Give a status of the build") - args = parser.parse_args(sys.argv[2:]) - ctx = Context() - for recipe in Recipe.list_recipes(): - key = "{}.build_all".format(recipe) - keytime = "{}.build_all.at".format(recipe) - - if key in ctx.state: - status = "Build OK (built at {})".format(ctx.state[keytime]) - else: - status = "Not built" - print("{:<12} - {}".format( - recipe, status)) - - def create(self): - parser = argparse.ArgumentParser( - description="Create a new xcode project") - parser.add_argument("name", help="Name of your project") - parser.add_argument("directory", help="Directory where your project lives") - parser.add_argument("--add-framework", action="append", help="Additional Frameworks to include with this project") - args = parser.parse_args(sys.argv[2:]) - - from cookiecutter.main import cookiecutter - ctx = Context() - ensure_recipes_loaded(ctx) - - if not hasattr(ctx, "python_ver"): - logger.error("No python recipes compiled!") - logger.error("You must have compiled at least python2 or") - logger.error("python3 recipes to be able to create a project.") - sys.exit(1) - - template_dir = join(curdir, "tools", "templates") - context = { - "title": args.name, - "project_name": args.name.lower(), - "domain_name": "org.kivy.{}".format(args.name.lower()), - "kivy_dir": dirname(realpath(__file__)), - "project_dir": realpath(args.directory), - "version": "1.0.0", - "dist_dir": ctx.dist_dir, - "python_version": ctx.python_ver, - "python_major": ctx.python_major - } - cookiecutter(template_dir, no_input=True, extra_context=context) - filename = join( - getcwd(), - "{}-ios".format(args.name.lower()), - "{}.xcodeproj".format(args.name.lower()), - "project.pbxproj") - update_pbxproj(filename, pbx_frameworks=args.add_framework) - print("--") - print("Project directory : {}-ios".format( - args.name.lower())) - print("XCode project : {0}-ios/{0}.xcodeproj".format( - args.name.lower())) - - def update(self): - parser = argparse.ArgumentParser( - description="Update an existing xcode project") - parser.add_argument("filename", help="Path to your project or xcodeproj") - parser.add_argument("--add-framework", action="append", help="Additional Frameworks to include with this project") - args = parser.parse_args(sys.argv[2:]) - - filename = args.filename - if not filename.endswith(".xcodeproj"): - # try to find the xcodeproj - from glob import glob - xcodeproj = glob(join(filename, "*.xcodeproj")) - if not xcodeproj: - logger.error("Unable to find a xcodeproj in {}".format(filename)) - sys.exit(1) - filename = xcodeproj[0] - - filename = join(filename, "project.pbxproj") - if not exists(filename): - logger.error("{} not found".format(filename)) - sys.exit(1) - - update_pbxproj(filename, pbx_frameworks=args.add_framework) - print("--") - print("Project {} updated".format(filename)) - - def build_info(self): - ctx = Context() - print("Build Context") - print("-------------") - for attr in dir(ctx): - if not attr.startswith("_"): - if not callable(attr) and attr != 'archs': - print("{}: {}".format(attr, pformat(getattr(ctx, attr)))) - for arch in ctx.archs: - ul = '-' * (len(str(arch))+6) - print("\narch: {}\n{}".format(str(arch), ul)) - for attr in dir(arch): - if not attr.startswith("_"): - if not callable(attr) and attr not in ['arch', 'ctx', 'get_env']: - print("{}: {}".format(attr, pformat(getattr(arch, attr)))) - env = arch.get_env() - print("env ({}): {}".format(arch, pformat(env))) - - - def pip(self): - ctx = Context() - for recipe in Recipe.list_recipes(): - key = "{}.build_all".format(recipe) - if key not in ctx.state: - continue - recipe = Recipe.get_recipe(recipe, ctx) - recipe.init_with_ctx(ctx) - if not hasattr(ctx, "site_packages_dir"): - logger.error("python must be compiled before using pip") - sys.exit(1) - - pip_env = { - "CC": "/bin/false", - "CXX": "/bin/false", - "PYTHONPATH": ctx.site_packages_dir, - "PYTHONOPTIMIZE": "2", - # "PIP_INSTALL_TARGET": ctx.site_packages_dir - } - pip_path = sh.which("pip") - pip_args = [] - if len(sys.argv) > 2 and sys.argv[2] == "install": - pip_args = ["--isolated", "--ignore-installed", "--prefix", ctx.python_prefix] - args = [pip_path] + [sys.argv[2]] + pip_args + sys.argv[3:] - else: - args = [pip_path] + pip_args + sys.argv[2:] - - if not pip_path: - logger.error("pip not found") - sys.exit(1) - import os - logger.error("Executing pip with: {}".format(args)) - os.execve(pip_path, args, pip_env) - - def launchimage(self): - import xcassets - self._xcassets("LaunchImage", xcassets.launchimage) - - def icon(self): - import xcassets - self._xcassets("Icon", xcassets.icon) - - def xcode(self): - parser = argparse.ArgumentParser(description="Open the xcode project") - parser.add_argument("filename", help="Path to your project or xcodeproj") - args = parser.parse_args(sys.argv[2:]) - filename = args.filename - if not filename.endswith(".xcodeproj"): - # try to find the xcodeproj - from glob import glob - xcodeproj = glob(join(filename, "*.xcodeproj")) - if not xcodeproj: - logger.error("Unable to find a xcodeproj in {}".format(filename)) - sys.exit(1) - filename = xcodeproj[0] - sh.open(filename) - - def _xcassets(self, title, command): - parser = argparse.ArgumentParser( - description="Generate {} for your project".format(title)) - parser.add_argument("filename", help="Path to your project or xcodeproj") - parser.add_argument("image", help="Path to your initial {}.png".format(title.lower())) - args = parser.parse_args(sys.argv[2:]) - - if not exists(args.image): - logger.error("image path does not exists.") - return - - filename = args.filename - if not filename.endswith(".xcodeproj"): - # try to find the xcodeproj - from glob import glob - xcodeproj = glob(join(filename, "*.xcodeproj")) - if not xcodeproj: - logger.error("Unable to find a xcodeproj in {}".format(filename)) - sys.exit(1) - filename = xcodeproj[0] - - project_name = filename.split("/")[-1].replace(".xcodeproj", "") - images_xcassets = realpath(join(filename, "..", project_name, - "Images.xcassets")) - if not exists(images_xcassets): - logger.warning("Images.xcassets not found, creating it.") - makedirs(images_xcassets) - logger.info("Images.xcassets located at {}".format(images_xcassets)) - - command(images_xcassets, args.image) - - ToolchainCL() -======= main() ->>>>>>> upstream/master