Skip to main content

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']

Buildout 1.5 and higher

When one uses zc.buildout 1.5 or higher, the system’s environment is manipulated. In particular, the PYTHONPATH OS environment variable is rewritten. In that case it should be deleted:

>>> import os
>>> bo_orig_path = os.environ.pop('BUILDOUT_ORIGINAL_PYTHONPATH', None)
>>> orig_path = os.environ.get('PYTHONPATH')
>>> os.environ['PYTHONPATH'] = '/bogus'
>>> finder.find_files(os.path.join(repos, 'dir1'))
['data1.txt', 'dir11/data1.txt']
>>> if bo_orig_path:
...     os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = bo_orig_path
>>> if orig_path:
...     os.environ['PYTHONPATH'] = orig_path

CHANGES

1.1.1 (2010-08-30)

  • Bug: Improve the Buildout support. Thanks to Gary Poster for helping me out.

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.

Metadata

Release files for z3c.setuptools_mercurial 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for z3c.setuptools_mercurial 1.1.1
File Size Uploaded Provenance Actions
z3c.setuptools_mercurial-1.1.1.tar.gz 5.5 kB Without provenance Details for z3c.setuptools_mercurial-1.1.1.tar.gz

Release files / z3c.setuptools_mercurial-1.1.1.tar.gz

Download URL z3c.setuptools_mercurial-1.1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fb0a9f1d33ce7543e87170811d5cec49d935897294b29a6c104d590344e3e6ac
BLAKE2b-256 checksum
How to use checksums
1d9bc30552fb493cd4919421f2003738248bfb8efb5215c2e0675f253f648a6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for z3c.setuptools_mercurial 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page