Last change
on this file since 15 was 15, checked in by ruud, 15 months ago |
python installs also wheel to avoid error messages
|
File size:
1.2 KB
|
Line | |
---|
1 | package geniusweb.javavenv;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 | import java.io.IOException;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Contains a Python Venv for a specific python tar.gz file. Requires the global
|
---|
8 | * variable PYTHON3 pointing to python3.exe file.
|
---|
9 | *
|
---|
10 | */
|
---|
11 | public class VenvWithFile {
|
---|
12 | private final File tgzfile; // the tgz file to be pip instaalled
|
---|
13 |
|
---|
14 | /**
|
---|
15 | *
|
---|
16 | * @param tgzfile the tgzfile that needs to be <code>pip install</code>ed in
|
---|
17 | * a python venv.
|
---|
18 | * @throws IOException
|
---|
19 | */
|
---|
20 | public VenvWithFile(File tgzfile) throws IOException {
|
---|
21 | if (tgzfile == null || !tgzfile.exists())
|
---|
22 | throw new IllegalArgumentException(
|
---|
23 | "tgzfile " + tgzfile + " must exist");
|
---|
24 | if (!tgzfile.canRead())
|
---|
25 | throw new IllegalArgumentException(
|
---|
26 | "tgzfile " + tgzfile + " must be readable");
|
---|
27 |
|
---|
28 | this.tgzfile = tgzfile;
|
---|
29 | String dirname = tgzfile.getName();
|
---|
30 | // remove .tar.gz or similar at the end.
|
---|
31 | if (dirname.contains(".")) {
|
---|
32 | dirname = dirname.substring(0, dirname.indexOf("."));
|
---|
33 | }
|
---|
34 | // remove bad chars
|
---|
35 | dirname = dirname.replaceAll("\\W", "");
|
---|
36 |
|
---|
37 | dirname = "" + "_" + dirname;
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Close the venv, release all resources. You can not use this PythonVenv
|
---|
43 | * after calling this anymore.
|
---|
44 | */
|
---|
45 | public synchronized void close() {
|
---|
46 |
|
---|
47 | }
|
---|
48 |
|
---|
49 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.