How to include script library

Asked by Blackpaw

This is possibly related to my previous sub directory question. I copied the xml.dom.minidom from python 2.5 and included it in my Pys60 builds using simplesis. Now that I'm trying to build a slef contained SIS using Python Community I don't know how to include it and make available to my application.

Question information

Language:
English Edit question
Status:
Solved
For:
PyS60 community Edit question
Assignee:
No assignee Edit question
Solved by:
Jussi Toivola
Solved:
Last query:
Last reply:
Revision history for this message
Best Jussi Toivola (jussi-toivola) said :
#1

You can use 'install' utility function( or any other function and variable defined in SConstruct) in your application's build.py.

The benefit of using install is that it also compiles your python files to byte-code if you have enabled it.

Example:
I have a 'mylibs' folder in applications/helloworld/. The mylibs folder contains __init__.py and mylibrary.py. The helloworld's build.py looks like this:
-------
import os
from os.path import dirname, abspath, join
import glob

# Install mylib to library folder
# APPLICATION_PATH from SConstruct
libdir = join( APPLICATION_PATH, "mylib/*.py" )
files = glob.glob( libdir )
install( SISNAME_PYTHON_MAIN, files, join( PATH_PY_LIBS, "mylib") )

Application("helloworld")
-------

At the end it should say:
...
Install file: "applications\helloworld\mylib\mylibrary.py" as "M:\epoc32\winscw\c\PythonCommunity\mylib\mylibrary.py"
Install file: "applications\helloworld\mylib\__init__.py" as "M:\epoc32\winscw\c\PythonCommunity\mylib\__init__.py"
...
And when building with GCCE it should be found in the PythonCommunity.pkg( or whatever your's is :)
...
"gcce_urel\packages\PythonCommunity.sis\PythonCommunity\mylib\__init__.py" - "!:\PythonCommunity\mylib\__init__.py"
"gcce_urel\packages\PythonCommunity.sis\PythonCommunity\mylib\mylibrary.py" - "!:\PythonCommunity\mylib\mylibrary.py"
...

Revision history for this message
Blackpaw (blackpaw) said :
#2

Thanks Jussi, that worked perfectly.

Revision history for this message
Blackpaw (blackpaw) said :
#3

Thanks Jussi Toivola, that solved my question.