Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (53 sloc) 2.45 KB

Code organization

The code is organized as follow:

$ tree -L 1
├── data
├── devel-notes.rst
├── doc
├── examples
├── fake_pyrex
├── LICENSE.txt
├── pytpm
├── PyTPM.egg-info
├── README.txt
├── src
  1. Directory data is used for scripts used while developing the code. These are used for generating tests data, summarizing test results and others.

  2. The fake_pyrex directory exists so that distribute will run Cython on the Cython source file and generate the C extension. See for more details.

  3. I use distribute so that I can run python test after making any changes, without having to install the package first. This is possible with distribute/setuptools but not with distutils.

  4. To make the above possible, I have the pytpm/ directory with all the contents of the module and a directory pytpm/tests/ that contain the tests. The argument test_suite in is set to this directory.

    With this setup, when I type python test, Cython is run on the Cython code in src/, then it is compiled to form the module, which is then copied to pytpm. Then the tests inside the pytpm.tests sub-package is run.

  5. While developing I do not want to keep compiling the C library. For this I created a static library of TPM in src/tpm/libtpm.a and then ask setuptools to link to this library. This is done in See it for more comments.

  6. When shipping the code I want to compile the C library. Also I do not want Cython to be run. Instead the Cython generated C file should be directly used. This ensures that any version mismatch with user's Cython doesn't cause any problems. In fact the source distribution (sdist) does not include the Cython source code. This is achieved by

So in short, if you want to work on the Cython code, then create a static libtpm.a file in src/tpm and then use Run python test. This will create the Cython generated C file. If you just want to test/install it then simply run python test/install. This will use the existing Cython generated C file and will compile all the C files in src/tpm/.

Jump to Line
Something went wrong with that request. Please try again.