Skip to main content

Mercurial File Finder Plugin for Setuptools

Project description

A simple setuptools plugin to support creating distributions from a mercurial-based package checkout.

Detailed Documentation

Mercurial File Finder Plugin for Setuptools

This package provides a simple, command-based file finder plugin for setuptools. Once installed, one can create distributions using a pacakge that has been checked out with Mercurial.

So let’s create a workspace:

>>> import tempfile
>>> ws = tempfile.mkdtemp()

Since the workspace is not a mercurial repository, the finder returns an empty list and leaves an error message in the logs:

>>> from z3c.setuptools_mercurial import finder
>>> finder.find_files(ws)
abort: There is no Mercurial repository here (.hg not found)! (code 255)
<BLANKLINE>
[]

Also, if the directory does not exist, we get an error message, but an empty result set:

>>> finder.find_files('/foo')
[Errno 2] No such file or directory: '/foo'
[]

Let’s now create a new repository:

>>> import os
>>> repos = os.path.join(ws, 'test')
>>> cmd('hg init ' + repos)

The finder still fails with error code 1, since no file is yet added in the repository:

>>> finder.find_files(repos)
(code 1)
[]

Let’s now add soem directories and files and the finder should be happy.

>>> cmd('touch ' + os.path.join(repos, 'data.txt'))
>>> cmd('hg add ' + os.path.join(repos, 'data.txt'))
>>> cmd('mkdir ' + os.path.join(repos, 'dir1'))
>>> cmd('touch ' + os.path.join(repos, 'dir1', 'data1.txt'))
>>> cmd('hg add ' + os.path.join(repos, 'dir1', 'data1.txt'))
>>> cmd('mkdir ' + os.path.join(repos, 'dir1', 'dir11'))
>>> cmd('touch ' + os.path.join(repos, 'dir1', 'dir11', 'data1.txt'))
>>> cmd('hg add ' + os.path.join(repos, 'dir1', 'dir11', 'data1.txt'))
>>> finder.find_files(repos)
['data.txt',
 'dir1/data1.txt',
 'dir1/dir11/data1.txt']

Note that the result of the finder is always a list of relative locations based on the input directory.

>>> finder.find_files(os.path.join(repos, 'dir1'))
['data1.txt',
 'dir11/data1.txt']

CHANGES

1.1.0 (2010-08-30)

  • Feature: Make z3c.setuptools_mercurial compatible with Buildout 1.5, which does not include the standard PYTHONPATH by default anymore. This caused mercurial not to find its library.

  • Feature: Use doctest instead of zope.testing.doctest.

  • Feature: Update coverage setup.

1.0.1 (2009-12-16)

  • Feature: Add a test for getting the file list within a sub-directory of the repository.

  • Bug: It turns out that setuptools does not like “./<path>” notation but only “<path>”. Fixed the problem.

1.0.0 (2009-12-15)

  • Initial release.

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

z3c.setuptools_mercurial-1.1.0.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file z3c.setuptools_mercurial-1.1.0.tar.gz.

File metadata

File hashes

Hashes for z3c.setuptools_mercurial-1.1.0.tar.gz
Algorithm Hash digest
SHA256 725a5a6ea2deb8762cc4f39d3ab3b47567a16d47c11a5b519fa71c0d28f50515
MD5 e5143f55de5cf9588d3e86d456f2c4db
BLAKE2b-256 36cfcba73baada628ad5de1b8d8df1a56d7e185d076ac0aac450cbff40e97454

See more details on using hashes here.

Supported by

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