Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install tha.sdistmaker

How to install tha.sdistmaker

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install tha.sdistmaker
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.1 Available View build log
Windows (64-bit)
1.1 Available View build log
Mac OS X (10.5+)
1.1 Available View build log
Linux (32-bit)
1.1 Available View build log
Linux (64-bit)
1.1 Available View build log
 
License
BSD
Lastest release
version 1.1 on Jan 5th, 2011

tha.sdistmaker

Create sdist tarballs from svn tags, intended for use with a company-internal svn repository. Creates sdist tarballs into a directory you can then serve with apache.

Written by Reinout van Rees at The Health Agency.

More details in src/tha/sdistmaker/USAGE.txt .

Usage of tha.sdistmaker

tha.sdistmaker has two main uses:

  • Make and store an sdist tarball of a single tag.
  • Go through all tags and ensure they all have an sdist tarball.
Test setup

"Pypi" directory for placing tarballs:

>>> print pypidir
PYPI

Monkeypatching to prevent real action from taking place:

>>> import commands
>>> orig_getstatusoutput = commands.getstatusoutput
>>> output_results = ['']
>>> def mock_getstatusoutput(cmd):
...     print "Command:", cmd
...     return 0, output_results.pop(0)
>>> commands.getstatusoutput = mock_getstatusoutput
>>> commands.getstatusoutput('make tea')
Command: make tea
(0, '')
>>> import shutil
>>> orig_copy = shutil.copy
>>> def mock_copy(src, dest):
...     print "Mock copy %s -> %s" % (src, dest)
...     open(dest, 'w').write('mock')
>>> shutil.copy = mock_copy
Making sdist tarball of a single tag
>>> from tha.sdistmaker import maker
>>> tag = 'http://example.org/repo/project/tags/0.1'

The script makes an svn checkout of the tag and uses setuptools to grab the name and version and to make an sdist. This is then copied to the pypi dir in a subdirectory named after the project.

>>> output_results = ['',
...                   'project',
...                   '0.1',
...                   '',
...                   ]
>>> maker.main(tag=tag, destination=pypidir)
Doing checkout of http://example.org/repo/project/tags/0.1
Command: svn co http://example.org/repo/project/tags/0.1 ...
Detecting name and version
Command: python setup.py --name
Name: project
Command: python setup.py --version
Version: 0.1
Making sdist tarball
Command: python setup.py sdist
<BLANKLINE>
Creating directory PYPI/project
Copying tarball project-0.1.tar.gz
Mock copy dist/project-0.1.tar.gz -> PYPI/project/project-0.1.tar.gz

A new directory for the project is created:

>>> import os
>>> os.listdir(pypidir)
['project']

And the tarball is in there:

>>> sorted(os.listdir(os.path.join(pypidir, 'project')))
['project-0.1.tar.gz']

A new release is placed alongside just fine:

>>> tag = 'http://example.org/repo/project/tags/0.2'
>>> output_results = ['',
...                   'project',
...                   '0.2',
...                   '',
...                   ]
>>> maker.main(tag=tag, destination=pypidir)
Doing checkout of http://example.org/repo/project/tags/0.2
Command: svn co http://example.org/repo/project/tags/0.2 ...
Detecting name and version
Command: python setup.py --name
Name: project
Command: python setup.py --version
Version: 0.2
Making sdist tarball
Command: python setup.py sdist
<BLANKLINE>
Copying tarball project-0.2.tar.gz
Mock copy dist/project-0.2.tar.gz -> PYPI/project/project-0.2.tar.gz
>>> os.listdir(pypidir)
['project']
>>> sorted(os.listdir(os.path.join(pypidir, 'project')))
['project-0.1.tar.gz', 'project-0.2.tar.gz']

And a second project:

>>> tag = 'http://example.org/repo/another/tags/0.2'
>>> output_results = ['',
...                   'another',
...                   '0.2',
...                   '',
...                   ]
>>> maker.main(tag=tag, destination=pypidir)
Doing checkout of http://example.org/repo/another/tags/0.2
Command: svn co http://example.org/repo/another/tags/0.2 ...
Detecting name and version
Command: python setup.py --name
Name: another
Command: python setup.py --version
Version: 0.2
Making sdist tarball
Command: python setup.py sdist
<BLANKLINE>
Creating directory PYPI/another
Copying tarball another-0.2.tar.gz
Mock copy dist/another-0.2.tar.gz -> PYPI/another/another-0.2.tar.gz
>>> sorted(os.listdir(pypidir))
['another', 'project']
>>> sorted(os.listdir(os.path.join(pypidir, 'project')))
['project-0.1.tar.gz', 'project-0.2.tar.gz']
>>> sorted(os.listdir(os.path.join(pypidir, 'another')))
['another-0.2.tar.gz']

Restore originals:

>>> commands.getstatusoutput = orig_getstatusoutput
>>> shutil.copy = orig_copy

TODO

  • Probably a whole lot of things.

Changelog of tha.sdistmaker

1.1 (2009-12-22)
  • Documentation update.
1.0 (2009-12-21)
  • Setup.py cleanup.
0.4 (2009-11-09)
  • Replacing base and base_on_server the right way around, now.
0.2 (2009-11-09)
  • Cleaning up the tempdir after we're finished with it. And cd'ing out of

System Message: WARNING/2 (<string>, line 193)

Bullet list ends without a blank line; unexpected unindent.

that dir before zapping it.

  • Using buildout's bin/python so that we get setuptools also when run on the

System Message: WARNING/2 (<string>, line 196)

Bullet list ends without a blank line; unexpected unindent.

server where there's no global setuptools. This assumes we're always run within buildout: fine with me.

0.1 (2009-11-06)
  • Added sdist_from_tags script for creating all tarballs.
  • Added make_sdist script for creating a single sdist.
  • Initial library skeleton created by thaskel.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.