setup.py Development

[ Development was completed in November 2013. This page archives the design work for the project. ]

Our setup program must make it easy to install and run OpenVisualizer, but still support rapid testing by developers within the repository tree. This page supports the parent JIRA issue, SW-98.

Layouts

We support four directory layouts. The main challenge is to know the location of configuration and data files. We plan to check in the order the layouts are described below.

  1. SCons – Run from the development repository via SCons. Data/config file directory identified by --appdir parameter passed in to executable.
  2. Double-click – Run from the development repository by double-clicking on the executable. Data/config file directory identified by the directory portion of __file__ attribute on openVisualizerApp.py, which is in the same directory as the startup script.
  3. Tree-based install – Default arrangement for setup.py. Files are contained within some directory tree; on Windows, C:\Python27. Data/config file directory must be in 'data' subdirectory relative to the directory portion of the __file__ attribute on openvisualizer_utils.py, which now is in the 'openvisualizer' package. The key is that all data/conf files are packaged as 'package data' relative to the openvisualizer package. No matter how the user actually installls the app (with –prefix, --home, etc.), we always can find openvisualizer_utils.py, assuming pythonpath has been initialized properly on the user's PC. See attached tree-layout.txt for an example layout. Requires use of MANIFEST.in to identify the data files.
  4. Native install – This is a special build designed for embedded Linux, although it works for Windows as well. On Linux we use /etc for config files and /usr/local/share for web data files. Directories are identified by ActiveState's appdirs library. The user must not alter the destination directories. See attached native-layout.txt for an example layout.

Repository Changes

  • Created treeSetup.py and nativeSetup.py.
  • Created ovVersion.py with version number, and MANIFEST.tree for tree build.
  • Added appdirs.py for native directories for external files.
  • Dynamically determine the type of install at runtime – SCons, double-click, tree, or native.
  • Moved top-level packages to openvisualizer package
  • Fixed SW-79 – converted doxygen comments to Sphinx format.
  • Added abbreviated copyright notice to all files
  • Use logging.NullHandler implementation; requires Python 2.7.
  • Moved openUI package to an openvisualizer sub-package
  • Created SConscript in bin/openVisualizerApp directory for running UI, to reduce clutter in main SConstruct.
  • Added sdist and sdist-native targets for SCons.
  • Add 'build' directory to repository so it is not created by root when run UI. Conflict for example when build docs as regular user.
  • Rename build sub-directory when run UI from SCons to 'runui'. Clearer.
  • Added --ovDebug for SCons UI runner, and --debug directly from UI. More logging at startup.
  • Normalize line endings to LF, and added .gitattributes. Was unable to run app under Linux directly, like 'openVisualizerWeb.py'. The new solution is idiomatic.
  • pathHelper.py pared down. Don't need PyDispatcher in repository – simpler/cleaner to treat it like any other library.
  • Added bin/openVisualizeApp/sim_files for simulation. Added copy-simfw target in SCons. Removed fwdir parameter and variable from openVisualizerApp.py.
  • Added README.txt

TODO

  • Decide on version number in ovVersion.py.
  • Simulation support:
    • easy generation of 32-bin and 64-bit libraries from openwsn-fw (via virtualenv?).
    • dynamic selection of library at runtime
  • Implement SW-74 pip installer, for requirements.
  • Integrate use of openvisualizer.conf, including port..