Pages

Showing posts with label svn. Show all posts
Showing posts with label svn. Show all posts

Saturday, 30 June 2012

svn in virtualenv

I had some issues having svn in my virtual env - because it is created with the --no-site-packages (as it is the default).
What to do?
From the local python, this script will print out the commands for you:
python - << EOF
from os.path import dirname, join
import svn
dist_packages_dir = dirname(dirname(svn.__file__))
print 'cp -r', ' '.join(
  [join(dist_packages_dir, lib) 
    for lib in ['svn', 'libsvn']]),\
  "yourvirtualenvssitepackagesdir"
EOF
And replace yourvirtualenvssitepackagesdir with the site packages dir of your virtualenv

Saturday, 9 June 2012

Python package structure

I always forgot what should be - the project structure - the contents of setup.py Basically it is just a duplication of The Hitchhiker's Guide to Packaging v1.0 documentation/Creating a Package
TowelStuff/
    bin/
    CHANGES.txt
    docs/
    LICENSE.txt
    MANIFEST.in
    README.txt
    setup.py
    towelstuff/
        __init__.py
        location.py
        utils.py
        test/
            __init__.py
            test_location.py
            test_utils.py
And your setup.py should look like this:
from setuptools import setup

setup(
    name="TowelStuff",
    version="0.1",
    packages=["towelstuff"],
    install_requires=["nose"]
    )
The other question: What should the subversion structure look like? I looked the Trac guys, to see how they do:
http://svn.edgewall.org/repos/trac/trunk/
  ...
  trac
  setup.py
  ...
So I will use the same setup.