buildout.dumppickedversions
Q: What is a buildout extension ?
A: http://pypi.python.org/pypi/zc.buildout#extensions
The problem
When using a zc.buildout based deployment system I want to be able to reproduce the same setup with the same set of egg versions one month later. Without pinning all eggs the task is impossible.
Solution
buildout.dumppickedversions is a buildout extension that does just that. It can print or generate a versions.cfg file with all not pinned eggs.
buildout.dumppickedversions options
- dump-picked-versions-file
A file name you want buildout.dumppickedversions to write to. If not given buildout.dumppickedversions will dump the versions to the screen.
- overwrite-picked-versions-file
If set to true, buildout.dumppickedversions will overwrite the file defined in dump-picked-versions-file if it exists. Defaults to True.
Detailed Documentation
Let’s create an egg to use it in our tests:
>>> mkdir('myegg')
>>> write('myegg', 'setup.py',
... '''
... from setuptools import setup
... setup(name='myegg', version='1.0',)
... ''')
>>> write('myegg', 'README', '')
>>> print system(buildout+' setup myegg bdist_egg'), # doctest: +ELLIPSIS
Running setup script 'myegg/setup.py'.
...
Now let’s create a buildout to install the egg and to use buildout.dumppickedversions:
>>> write('buildout.cfg',
... '''
... [buildout]
... extensions = buildout.dumppickedversions
... parts = foo
... find-links = %s
... index = http://pypi.python.org/simple
... [foo]
... recipe = zc.recipe.egg
... eggs = myegg
... ''' % join('myegg', 'dist'))
Running the buildout will print information about picked versions:
>>> print system(buildout), # doctest: +ELLIPSIS Getting distribution for 'buildout.dumppickedversions'. ... *************** PICKED VERSIONS **************** [versions] zc.buildout = N.N zc.recipe.egg = N.N myegg = N.N setuptools = N.N <BLANKLINE> *************** /PICKED VERSIONS ***************
To dump picked versions to a file, we just add an dump-picked-versions-file option and give a file name:
>>> write('buildout.cfg',
... '''
... [buildout]
... extensions = buildout.dumppickedversions
... dump-picked-versions-file = versions.cfg
... parts = foo
... find-links =
... %s
... index = http://pypi.python.org/simple
... [foo]
... recipe = zc.recipe.egg
... eggs =
... myegg
... ''' % join('myegg', 'dist'))
>>> print system(buildout), # doctest: +ELLIPSIS
Uninstalling foo.
Installing foo.
*********************************************
Writing picked versions to versions.cfg
*********************************************
And here is the content of the file versions.cfg:
>>> cat('versions.cfg')
[versions]
zc.buildout = N.N
zc.recipe.egg = N.N
myegg = N.N
setuptools = N.N
<BLANKLINE>
Next time we run the buildout the file will be overwritten:
>>> print system(buildout), # doctest: +ELLIPSIS Updating foo. ********************************************* Overwriting versions.cfg *********************************************
When we don’t want to overwrite the file we just add an overwrite-picked-versions-file and set it to false:
>>> write('buildout.cfg',
... '''
... [buildout]
... extensions = buildout.dumppickedversions
... dump-picked-versions-file = versions.cfg
... overwrite-picked-versions-file = false
... parts = foo
... find-links =
... %s
... index = http://pypi.python.org/simple
... [foo]
... recipe = zc.recipe.egg
... eggs =
... myegg
... ''' % join('myegg', 'dist'))
>>> print system(buildout), # doctest: +ELLIPSIS
Updating foo.
*********************************************
Skipped: File versions.cfg already exists.
*********************************************
Change history
0.2 (2009-03-15)
Removed the buildout header from the dumped file [mustapha]
Added overwrite-picked-versions-file option [mustapha]
0.1 (2009-02-07)
Created recipe with ZopeSkel. [mustapha]
Contributors
Mustapha Benali, Author
Metadata
Release files for buildout.dumppickedversions 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| buildout.dumppickedversions-0.2.tar.gz | 5.8 kB | Details |
Release files / buildout.dumppickedversions-0.2.tar.gz
| Download URL | buildout.dumppickedversions-0.2.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7acfd41f3a33a59aa68aae61577d9f72d9c6dfc746b6227174f5f0d4750f5a1
|
|
BLAKE2b-256 checksum How to use checksums |
7fd41f77d32e3320d91a1c0d4630ce5ed4acad1e5de5ae8841f5b291da88608e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |