Skip to content
Snippets Groups Projects
Commit 719a286f authored by Clément Jonglez's avatar Clément Jonglez
Browse files

add hook to make orekit_jpype pyinstallable

parent a829028f
No related branches found
No related tags found
1 merge request!6add hook to make orekit_jpype pyinstallable
import os
from pathlib import Path
fspath = getattr(os, 'fspath', str)
_pyinstaller_path = Path(__file__).parent
def get_hook_dirs():
return [fspath(str(_pyinstaller_path))]
def get_PyInstaller_tests():
return [fspath(_pyinstaller_path)]
import os
from pathlib import Path
import orekit_jpype
fspath = getattr(os, 'fspath', str)
jar_path_glob = Path(orekit_jpype.__file__).parent.joinpath("jars", "*.jar")
datas = [[fspath(jar_path_glob), os.path.join("orekit_jpype", "jars")]]
import orekit_jpype as orekit
orekit.initVM()
from orekit_jpype.pyhelpers import setup_orekit_data
setup_orekit_data(from_pip_library=True)
from org.orekit.utils import Constants
assert(Constants.WGS84_EARTH_EQUATORIAL_RADIUS == 6378137.0)
import os
from pathlib import Path
from subprocess import run
import PyInstaller.__main__
fspath = getattr(os, 'fspath', str)
test_file = Path(__file__).parent.joinpath('orekit_data_load_example.py')
def test_start_and_stop(tmp_path):
name = 'orekit_jpype_test_app'
dist = tmp_path.joinpath('dist')
work = tmp_path.joinpath('build')
PyInstaller.__main__.run([
'--name', name,
'--distpath', fspath(dist),
'--workpath', fspath(work),
'--collect-data', 'orekitdata',
fspath(test_file)
])
run([str(dist / name / name)], check=True)
......@@ -40,5 +40,11 @@ tests = [
]
[pytest]
testpaths = "test"
testpaths = [
"test",
"orekit_jpype/_pyinstaller"
]
[project.entry-points.pyinstaller40]
"hook-dirs" = "orekit_jpype._pyinstaller.entry_points:get_hook_dirs"
"tests" = "orekit_jpype._pyinstaller.entry_points:get_PyInstaller_tests"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment