From b871e60343365d53451c6283edd548804bf58e67 Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Thu, 23 Nov 2023 18:40:54 +0000 Subject: [PATCH] much simplified building instructions --- docs/source/building.rst | 115 +++++++---------------------------- docs/source/installation.rst | 5 +- 2 files changed, 25 insertions(+), 95 deletions(-) diff --git a/docs/source/building.rst b/docs/source/building.rst index 89369bfc..ea42a361 100644 --- a/docs/source/building.rst +++ b/docs/source/building.rst @@ -3,20 +3,32 @@ Building PYJNIus ================ -Building PyJNIus depends on `Cython `_ and the `Java +Building PyJNIus is necessary for development purposes, or if there is no +pre-built binary for your particular platform. + +Like installation of PyJNIus, building PyJNIus requires a `Java `_ Development Kit -(includes the Java Runtime Environment). +to be installed. + +Apart from the JDK, the building requirements for each platform are as follows: + - Linux: the GNU Compiler Collection (GCC). + - Windows Microsoft Visual C++ Build Tools (command-line tools subset of Visual + Studio) can be obtained from https://visualstudio.microsoft.com/downloads/. + For more information or options, see Python's `Windows Compilers wiki + `_. + - macOS: `Xcode command-line tools `_. -Building on GNU/Linux distributions ------------------------------------ +In all cases, PyJNIus can be *built* and installed using:: -You need the GNU Compiler Collection (GCC), the JDK installed (openjdk -will do), and Cython. Then, just type:: + pip install . - pip install . +This installs Cython (as specified in the +`pyproject.toml `_) +in a Python build environment. On all platforms, if PyJNIus cannot find your JDK, you can set +the `JAVA_HOME` shell environment variable (this is often needed on Windows). -If you want to compile the extension within the directory for any development, +If you want to compile the PyJNIus extension within the directory for any development, just type:: make @@ -25,88 +37,5 @@ You can run the tests suite to make sure everything is running right:: make tests - -Building on Windows -------------------- - -Python and pip must be installed and present in the ``PATH`` environment variable. - -1. Download and install the JDK containing the JRE: - - https://www.oracle.com/java/technologies/downloads/ - -2. Edit your system and environment variables (use the appropriate Java bitness - and version in the paths): - - Add to your `Environment Variables - `_: - - * ``JAVA_HOME``: C:\\Program Files\\Java\\jdk1.x.y_zz\\bin - * ``PATH``: C:\\Program Files\\Java\\jdk1.x.y_zz\\jre\\bin\\server - contains the ``jvm.dll`` necessary for importing and using PyJNIus. - - .. note:: - set PATH=%PATH%;C:\\Program Files\\Java\\jdk1.x.y_zz\\jre\\bin\\server - - Add to System Variables or have it present in your ``PATH``: - * ``PATH``: C:\\Program Files\\Java\\jdk1.x.y_zz\\bin` - -3. Download and install the C compiler: - - Microsoft Visual C++ Build Tools (command-line tools subset of Visual - Studio) can be obtained from https://visualstudio.microsoft.com/downloads/ - - For more information or options, see Python's `Windows Compilers wiki - `_. - -4. Update `pip `_ and setuptools:: - - python -m pip install --upgrade pip setuptools - -5. Install Cython:: - - python -m pip install --upgrade cython - -6. Install Pyjnius:: - - pip install pyjnius - - .. note:: - In case of MinGWPy's GCC returning a ``CreateProcess failed: 5`` error - you need to run the command prompt with elevated permissions, so that - the compiler can access the JDK in ``C:\Program Files\Java\jdkx.y.z_b`` - or ``C:\Program Files (x86)\Java\jdkx.y.z_b``. - - -Building for macOS ------------------- - -Python and pip must be installed and present in the ``PATH`` environment variable. - - -1. Download and install the JDK containing the JRE: - - https://www.oracle.com/java/technologies/downloads/ - -2. Edit your system and environment variables (use the appropriate Java bitness - and version in the paths): - - Add to your `Environment Variables - `_: - - * ``export JAVA_HOME=/usr/libexec/java_home`` - -3. Install Xcode command-line tools. - -4. Update `pip `_ and setuptools:: - - python -m pip install --upgrade pip setuptools - -5. Install Cython:: - - python -m pip install --upgrade cython - -6. Install Pyjnius:: - - pip install pyjnius - +In these cases, you may need to have `Cython `_ +and `pytest `_ installed in the current Python environment. \ No newline at end of file diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 3e5cc16d..32f1dbdc 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -16,9 +16,10 @@ If there is no pre-compiled binary available, pip install will aim to compile a binary on your operating system. For more information see the :ref:`building` documentation. -You will need the Java JDK installed (`OpenJDK `__` is fine). +You will need the Java JDK installed (`OpenJDK `_ is fine). PyJNIus searches for Java in the usual places on each operating system. If PyJNIus -cannot find Java, set the `JAVA_HOME` environment variable. +cannot find Java, set the `JAVA_HOME` environment variable (this is often needed +`on Windows `_). Installation for Android ------------------------