Mercurial > repos > jankanis > package_python3_4
annotate tool_dependencies.xml @ 17:d30e6a97dfbf draft default tip
add dependency on zlib
author | jankanis |
---|---|
date | Wed, 28 May 2014 10:44:03 -0400 |
parents | 7719329e5b98 |
children |
rev | line source |
---|---|
0 | 1 <?xml version="1.0"?> |
2 <tool_dependency> | |
3 <package name="openssl" version="1.0.1g"> | |
16 | 4 <repository changeset_revision="3b19041c651c" name="package_openssl_1_0" owner="iuc" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu" /> |
0 | 5 </package> |
6 | |
17 | 7 <package name="zlib" version="1.2.8"> |
8 <repository changeset_revision="31f1e69aae89" name="package_zlib_1_2_8" owner="iuc" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu" /> | |
9 </package> | |
10 | |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
11 <package name="sqlite" version="3.8.3"> |
7 | 12 <repository changeset_revision="706b1f3b1fc0" name="package_sqlite_3_8_3" owner="iuc" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu" /> |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
13 </package> |
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
14 |
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
15 <package name="gdbm" version="1.11"> |
16 | 16 <repository changeset_revision="ad3c23208758" name="package_gdbm_1_11" owner="iuc" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu" /> |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
17 </package> |
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
18 |
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
19 |
0 | 20 <package name="python3" version="3.4.1"> |
21 <install version="1.0"> | |
22 <actions> | |
1 | 23 <action type="download_by_url">https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz</action> |
9
d3ea5f1b4d79
Another attempt at getting the environment settings right.
jankanis
parents:
8
diff
changeset
|
24 |
0 | 25 <action type="set_environment_for_install"> |
17 | 26 <repository changeset_revision="31f1e69aae89" name="package_zlib_1_2_8" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu"> |
27 <package name="zlib" version="1.2.8" /> | |
28 </repository> | |
16 | 29 <repository changeset_revision="3b19041c651c" name="package_openssl_1_0" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu"> |
0 | 30 <package name="openssl" version="1.0.1g" /> |
31 </repository> | |
7 | 32 <repository changeset_revision="706b1f3b1fc0" name="package_sqlite_3_8_3" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu"> |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
33 <package name="sqlite" version="3.8.3" /> |
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
34 </repository> |
16 | 35 <repository changeset_revision="ad3c23208758" name="package_gdbm_1_11" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu"> |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
36 <package name="gdbm" version="1.11" /> |
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
37 </repository> |
0 | 38 </action> |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
39 |
9
d3ea5f1b4d79
Another attempt at getting the environment settings right.
jankanis
parents:
8
diff
changeset
|
40 <action type="shell_command"> |
12 | 41 # The python build system doesn't check CPATH / C(PLUS)_INCLUDE_PATH which is set by the depended-upon |
42 # tool definitions for these sources, but it does check CPPFLAGS / LDFLAGS | |
15 | 43 # Currently not whitespace-safe, I haven't found a way yet to quote the *FLAGS values so that they are |
16 | 44 # correctly recognized by both the python build process and the compiler. But as galaxy itself isn't |
15 | 45 # whitespace-safe either it doesn't really matter (currently). |
12 | 46 oldifs="$IFS" |
16 | 47 IFS=":" |
12 | 48 for p in $CPLUS_INCLUDE_PATH |
49 do | |
50 CPPFLAGS="$CPPFLAGS -I$p" | |
51 done | |
52 for p in $LD_LIBRARY_PATH | |
53 do | |
13
9dbfc4fcef0a
Fix LDFLAGS. This version is not yet safe against paths containing whitespace.
jankanis
parents:
12
diff
changeset
|
54 LDFLAGS="$LDFLAGS -L$p" |
12 | 55 done |
56 IFS="$oldifs" | |
57 export CPPFLAGS | |
58 export LDFLAGS | |
59 | |
60 # Clear variables that may be used in Galaxy's extenal python 2 environment | |
61 unset PYTHONPATH | |
62 unset PYTHONHOME | |
63 | |
64 ./configure --prefix="$INSTALL_DIR" --with-ensurepip --enable-loadable-sqlite-extensions \ | |
65 && make \ | |
66 && make install | |
67 </action> | |
6
321cacd4ae43
Add dependencies and settings for sqlite and gdbm, so that python can build its packages for those.
jankanis
parents:
5
diff
changeset
|
68 |
1 | 69 <action type="set_environment"> |
70 <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable> | |
17 | 71 <environment_variable action="prepend_to" name="LD_LIBRARY_PATH">$ENV[LD_LIBRARY_PATH]</environment_variable> |
72 <!-- clear PYTHONPATH, otherwise we will get Galaxy's Python 2 libraries in the Python 3 path. --> | |
1 | 73 <environment_variable action="set_to" name="PYTHONPATH" /> |
74 <environment_variable action="set_to" name="PYTHONHOME">$INSTALL_DIR</environment_variable> | |
4 | 75 <environment_variable action="prepend_to" name="PKG_CONFIG_PATH">$INSTALL_DIR/lib/pkgconfig</environment_variable> |
1 | 76 </action> |
0 | 77 </actions> |
78 </install> | |
79 | |
80 <readme> | |
15 | 81 Python 3.4.1 |
0 | 82 |
16 | 83 The Python programming language version 3. |
84 | |
85 http://www.python.org | |
86 | |
87 | |
88 This build of python is configured with --enable-loadable-sqlite-extensions, any other settings are default. This build does not include modules for lzma and Tkinter, but does include ssl, (g)dbm and sqlite. Adding the missing modules should not be very difficult but requires wrapping the external sources that these modules require inside galaxy. | |
14
59b33d253163
re-export LD_LIBRARY_PATH so that the required libraries can also be found at runtime
jankanis
parents:
13
diff
changeset
|
89 |
17 | 90 Python as of version 3.3 includes a built-in virtual environment manager. To create a python 3 virtual env, include the following actions in your tool_dependencies.xml, e.g. for a package MY_TOOL_venv: |
0 | 91 |
92 <action type="set_environment_for_install"> | |
1 | 93 <repository name="python3" owner="jankanis"> |
0 | 94 <package name="python3" version="3.4.1" /> |
1 | 95 </repository> |
17 | 96 <!-- other install time dependencies --> |
0 | 97 </action> |
15 | 98 |
0 | 99 <action type="shell_command"> |
17 | 100 # Unset any saved environment settings from parent virtual |
101 # environments, e.g. for python 2 or if Galaxy itself is running | |
102 # from within a virtual environment. | |
103 unset _OLD_VIRTUAL_PATH; unset _OLD_VIRTUAL_PYTHONHOME | |
104 # Create virtual environment MY_TOOL_venv | |
105 pyvenv MY_TOOL_venv | |
106 # install python packages | |
107 MY_TOOL_venv/bin/pip3 install {{NEEDED_PYTHON_PACKAGES}} | |
0 | 108 </action> |
15 | 109 |
0 | 110 <action type="set_environment"> |
17 | 111 |
112 <!-- Setting the PYTHONPATH correctly can be a bit tricky, because you must | |
113 make sure that the runtime PYTHONPATH from galaxy itself is not | |
114 included, as it probably points to python 2 code that can crash a | |
115 program if python 3 tries to load it. | |
116 | |
117 If you only use a single virtual environment that is created | |
118 specifically for a tool you are creating, you can just use a set_to | |
119 like below. | |
120 | |
121 If you create a virtual environment installation that is meant to be | |
122 reused by other packages, the virtual environment should probably | |
123 prepend its site-packages to the PYTHONPATH since a tool could be | |
124 using python modules from several virtual environments. But in such a | |
125 scenario the tool that uses these virtual environments should also | |
126 depend directly on the python3 package, and this dependency should be | |
127 listed before any virtual environment dependencies. This ensures that | |
128 the python3 environment settings that clear PYTHONPATH are sourced | |
129 first so galaxy's runtime PYTHONPATH is excluded. Virtual environments | |
130 can then prepend their PYTHONPATHs to each other. --> | |
131 <environment_variable name="PYTHONPATH" action="set_to">$INSTALL_DIR/MY_TOOL_venv/lib/python3.4/site-packages</environment_variable> | |
132 <!-- All that is really needed to use a specific virtual environment is that the | |
133 python interpreter in that environment is used, so add it to PATH --> | |
134 <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/MY_TOOL_venv/bin</environment_variable> | |
135 <!-- Clear incoming PYTHONHOME just like the venv's 'activate' command does --> | |
136 <environment_variable name="PYTHONHOME" action="set_to"></environment_variable> | |
137 <!-- To find shared libraries for python built-in modules such as libssl or libsqlite3 | |
138 we need to re-export LD_LIBRARY_PATH --> | |
139 <environment_variable name="LD_LIBRARY_PATH" action="prepend_to">$ENV[LD_LIBRARY_PATH]</environment_variable> | |
0 | 140 </action> |
141 | |
17 | 142 |
143 Then, in your MY_TOOL.xml add the following requirement: | |
144 | |
145 <requirements> | |
146 <requirement name="package" version="XXX">MY_TOOL_venv</requirement> | |
147 </requirements> | |
148 | |
0 | 149 </readme> |
16 | 150 |
0 | 151 </package> |
152 </tool_dependency> |