File: develop.rst

package info (click to toggle)
vitables 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,044 kB
  • sloc: python: 9,695; makefile: 214; sh: 90
file content (145 lines) | stat: -rw-r--r-- 3,896 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Development Notes
=================

To create development environment:

.. code-block:: sh

   mkvirtualenv --system-site-packages vttest
   python setup.py develop

To generate dictionary of all datasets in all example files change dir
to ViTables folder and run:

.. code-block:: sh

   for d in arrays misc tables timeseries; do 
       d=examples/$d
       for f in `ls $d`; do
           f=$d/$f
           echo \'$f\': [
	   for n in `h5ls -r -S $f | grep 'Dataset' | sed s/\\\\\\\\\ /%/g | cut -f 1 -d ' ' | cut  -c 2-`; do
	       n=`echo $n | sed s/%/\ /g`
	       echo "    " \'$n\',
	   done
	   echo ],;
       done
   done

Installation
------------

Windows
+++++++

The easiest way to create a standalone windows installer is to use
WinPython and InnoSetup. A good description of the process was written
by `Cyrille Rossant
<http://cyrille.rossant.net/create-a-standalone-windows-installer-for-your-python-application/>`_.
The installer will create a single folder in `Program Files` that
contains Python and all required modules. There is currently a problem
with PyQt installation. That is if a different version of PyQt is
installed in the system then ViTables might crush on some functions.
There is a version of ViTables already installed in WinPython so if
old version is enough one can skip the steps below.

Applied to ViTables the procedure has the following steps:

1. Download source a ViTables source distribution. It is also possible
   to make one from the develop branch by executing the following command:

   .. code-block:: sh
      
      python setup.py sdist

2. Install InnoSetup. 

3. Download 32-bit version of WinPython that contains Python
   2.7. ViTables might work with Python 3 but was not tested atm.

4. Create `ViTables` folder and install WinPython in it.

5. Configure WinPython using `WinPython Control Panel.exe` that can be
   found inside installed WinPython. Remove ViTables from the
   installation and new `.tar.gz`.

6. Copy `vitables_setup.iss` from `mswindows` folder of ViTables
   development branch into the folder that contains ViTables dir with
   WinPython.

7. Open `vitables_setup.iss` and replace WinPython and python version
   numbers in the line

   .. code-block:: text

      #define pydir "WinPython-32bit-2.7.6.4\python-2.7.6"`.

8. Compile `vitables_setup.iss`, the installer will be placed into
   `Output` dir.


If Python 2.7 along with PyQt, future and numpy is already present
in the system then it is possible to install ViTables directly:

1. Clone development branch or download a source distribution that is
   based on it.

2. Switch to ViTables folder and run

   .. code-block:: sh
      
      python setup.py bdist_wininst

3. The installer will be created in `dist` folder. It can be used to
   install ViTables on a system that have Python and required
   libraries.

Plugins
-------

i18n
++++

1. Create module project file

   .. code-block:: text

        TRANSLATIONS = plugin_ru_RU.ts

        SOURCES = plugin/configure.py \
                  plugin/analyze.py

   
2. Run ``pylupdate4`` to create ``.ts`` file in top level folder:
   
   .. code-block:: sh

       pylupdate4 plugin.pro

3. Translate using ``linguist`` and store compiled version in, for
   example, ``i18n/plugin_ru_RU.qm``.

4. Create ``resources.qrc`` with resource description:

   .. code-block:: xml

        <!DOCTYPE RCC><RCC version="1.0">
        <qresource>
            <file>i18n/plugin_ru_RU.qm</file>
        </qresource>
        </RCC>

5. Compile resource

   .. code-block:: sh

       pyrcc4 -o plugin/resources.py resources.qrc

6. Add the following to plugin class level code:

   .. code-block:: python

        locale_name = qtcore.QLocale.system().name()
        translator = qtcore.QTranslator()
        if not translator.load(':/i18n/plugin_{0}.qm'.format(locale_name)):
             translator = None