-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporating Gradle tasks for downloading and automatically installi…
…ng JEP binaries for the Python frontend ### What's Done: 1) Introduced the `installJep` task to facilitate the automatic installation of JEP from [https://github.com/icemachined/jep-distro/](https://github.com/icemachined/jep-distro/). 2) Centralized and encapsulated the logic for JEP search and installation: all the relevant logic has been relocated to the Gradle task, separating it from the main code. The main code will now simply utilize the JEP stored in the `build/jep` directory.
- Loading branch information
Showing
4 changed files
with
182 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### CPG Python | ||
|
||
This module is essential for setting up the Python frontend for CPG. | ||
Python parsing is accomplished using native Python, necessitating the installation of [JEP](https://github.com/ninia/jep) for proper JNI functionality. Follow the instructions below to install JEP and enable the frontend. | ||
|
||
### Installation | ||
|
||
1. This module is disabled by default, so you need to enable it by adding the following to the root `gradle.properties`: | ||
|
||
```plaintext | ||
enablePythonFrontend=true | ||
``` | ||
2. If you have an x86 architecture, no further action is required as JEP will be automatically installed for Python 3.9-3.11 | ||
from [https://github.com/icemachined/jep-distro/releases/](https://github.com/icemachined/jep-distro/releases/). | ||
Check for the latest supported version of Python or JEP on that page. Python version can be set with `-Ppython` property: | ||
`./gradlew cpg-language-python:build -Ppython=3.12`, the default is `3.10` | ||
If you have a different architecture or wish to use another version of JEP or Python, you will need to install it manually. Here are potential solutions: | ||
- Utilize Homebrew/pip package manager to simplify the JEP installation process: | ||
```plaintext | ||
brew install pip3 | ||
pip3 install jep | ||
``` | ||
- Create a [virtual environment](https://docs.python.org/3/library/venv.html) with the specified environment variable `CPG_PYTHON_VIRTUALENV` | ||
set to `/(user.home)/.virtualenv/CPG_PYTHON_VIRTUALENV`. | ||
- Manually install JEP and specify the `CPG_JEP_LIBRARY` environment variable with the appropriate path to the installation. | ||
3. `./gradlew cpg-language-python:build` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters