Skip to main content

ZC buildout recipe to checkout a dir from a svn repository and archive it in a folder

Project description

This product is used to download packages from svn and tar them in a directory.

We need some buildout vars:

>>> write('buildout.cfg',
... """
... [buildout]
... parts=svn-package
...
... [svn-package]
... recipe=iw.recipe.subversion
... urls=
...   file:///%s/my_package/trunk my_package
... """ % repository)

We need a repository:

>>> create_repository()

Then, the recipe should work:

>>> print system(buildout)
Installing svn-package.
A    /sample-buildout/parts/svn-package/my_package/__init__.py
A    /sample-buildout/parts/svn-package/my_package/sub
A    /sample-buildout/parts/svn-package/my_package/sub/__init__.py
A    /sample-buildout/parts/svn-package/my_package/README.txt
Checked out revision 4.
<BLANKLINE>

Ok, we got it:

>>> ls('parts', 'svn-package')
d my_package

If a download-cache directory is given, then an archive is created in the specified path:

>>> write('buildout.cfg',
... """
... [buildout]
... download-cache=cache
... parts=svn-package
...
... [svn-package]
... recipe=iw.recipe.subversion
... urls=
...   file:///%s/my_package/trunk my_package
... """ % repository)

>>> rmtree('parts')
>>> cache = join(os.getcwd(), 'cache')
>>> mkdir(cache)

>>> print system(buildout)
Creating directory '/sample-buildout/parts'.
Uninstalling svn-package.
Installing svn-package.
A    /sample-buildout/parts/svn-package/my_package/__init__.py
A    /sample-buildout/parts/svn-package/my_package/sub
A    /sample-buildout/parts/svn-package/my_package/sub/__init__.py
A    /sample-buildout/parts/svn-package/my_package/README.txt
Checked out revision 4.
Creating archive: my_package-dev.tar.gz

>>> ls(cache)
d  dist
-  my_package-dev.tar.gz

Ok, now we can work offline. The package will be installed from the cache directory:

>>> write('buildout.cfg',
... """
... [buildout]
... install-from-cache=true
... download-cache=cache
... parts=svn-package
...
... [svn-package]
... recipe=iw.recipe.subversion
... urls=
...   file:///%s/my_package/trunk my_package
... """ % repository)

>>> rmtree(repository)
>>> rmtree('parts')
>>> print system(buildout)
Creating directory '/sample-buildout/parts'.
Uninstalling svn-package.
Installing svn-package.
<BLANKLINE>


>>> ls('parts', 'svn-package')
d  my_package

>>> ls('parts', 'svn-package', 'my_package')
-  README.txt
-  __init__.py
d  sub

Well, it’s ok for a trunk url. But when working with tagged version, we don’t want to use subversion if we already have an archive:

>>> write('buildout.cfg',
... """
... [buildout]
... download-cache=cache
... parts=svn-package
...
... [svn-package]
... recipe=iw.recipe.subversion
... urls=
...   file:///%s/my_package/tags/v1_0_0 my_package
... """ % repository)

At the first time, we need to update and built the archive:

>>> create_repository()
>>> print system(buildout)
Uninstalling svn-package.
Installing svn-package.
A    /sample-buildout/parts/svn-package/my_package/__init__.py
A    /sample-buildout/parts/svn-package/my_package/sub
A    /sample-buildout/parts/svn-package/my_package/sub/__init__.py
A    /sample-buildout/parts/svn-package/my_package/README.txt
Checked out revision 4.
Creating archive: my_package-v1_0_0.tar.gz
<BLANKLINE>

>>> ls('parts', 'svn-package', 'my_package')
d  .svn
-  README.txt
-  __init__.py
d  sub

>>> ls(cache)
d  dist
-  my_package-v1_0_0.tar.gz

Then we work can work offline:

>>> write('buildout.cfg',
... """
... [buildout]
... offline=true
... download-cache=cache
... parts=svn-package
...
... [svn-package]
... recipe=iw.recipe.subversion
... urls=
...   file:///%s/my_package/tags/v1_0_0 my_package
... """ % repository)

>>> rmtree(repository)
>>> rmtree('parts')
>>> print system(buildout)
Creating directory '/sample-buildout/parts'.
Uninstalling svn-package.
Installing svn-package.
<BLANKLINE>

>>> ls('parts', 'svn-package', 'my_package')
-  README.txt
-  __init__.py
d  sub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iw.recipe.subversion-0.3dev-r7581.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

iw.recipe.subversion-0.3dev_r7581-py2.4.egg (31.1 kB view details)

Uploaded Source

File details

Details for the file iw.recipe.subversion-0.3dev-r7581.tar.gz.

File metadata

File hashes

Hashes for iw.recipe.subversion-0.3dev-r7581.tar.gz
Algorithm Hash digest
SHA256 72e96426d19b1b54f9b094c058b7d78b3739bb18a255d93c1fd9e53d4f15d3b5
MD5 7a36f6ec80b71bf0a1e8d70cf14b2e0d
BLAKE2b-256 3f51371b65590a4085294d402382b0733b7ae96530e54c88ec8ec8ffecda6c06

See more details on using hashes here.

File details

Details for the file iw.recipe.subversion-0.3dev_r7581-py2.4.egg.

File metadata

File hashes

Hashes for iw.recipe.subversion-0.3dev_r7581-py2.4.egg
Algorithm Hash digest
SHA256 1180ba0f7cd4b142fb3b97f0b71c40b74e6453590891cdd73ceb5a8d1ea408be
MD5 2a21fb23f86e73742956bff73d3e6067
BLAKE2b-256 ff3f2c3ba5e6699fbb073a85d2f5a16b2b039769fa79ea381a6d3a7ee3a659e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page