[Checkins] SVN: z3c.setuptools_mercurial/trunk/ Import of project.
Stephan Richter
srichter at gmail.com
Tue Dec 15 21:10:27 EST 2009
Log message for revision 106612:
Import of project.
Changed:
A z3c.setuptools_mercurial/trunk/
A z3c.setuptools_mercurial/trunk/CHANGES.txt
A z3c.setuptools_mercurial/trunk/README.txt
A z3c.setuptools_mercurial/trunk/bootstrap.py
A z3c.setuptools_mercurial/trunk/buildout.cfg
A z3c.setuptools_mercurial/trunk/setup.py
A z3c.setuptools_mercurial/trunk/src/
A z3c.setuptools_mercurial/trunk/src/z3c/
A z3c.setuptools_mercurial/trunk/src/z3c/__init__.py
A z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/
A z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/README.txt
A z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/__init__.py
A z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/finder.py
A z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/tests.py
-=-
Added: z3c.setuptools_mercurial/trunk/CHANGES.txt
===================================================================
--- z3c.setuptools_mercurial/trunk/CHANGES.txt (rev 0)
+++ z3c.setuptools_mercurial/trunk/CHANGES.txt 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,8 @@
+=======
+CHANGES
+=======
+
+1.0.0 (2009-12-15)
+------------------
+
+- Initial release.
Property changes on: z3c.setuptools_mercurial/trunk/CHANGES.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: z3c.setuptools_mercurial/trunk/README.txt
===================================================================
--- z3c.setuptools_mercurial/trunk/README.txt (rev 0)
+++ z3c.setuptools_mercurial/trunk/README.txt 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,2 @@
+A simple setuptools plugin to support creating distributions from a
+mercurial-based package checkout.
Property changes on: z3c.setuptools_mercurial/trunk/README.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: z3c.setuptools_mercurial/trunk/bootstrap.py
===================================================================
--- z3c.setuptools_mercurial/trunk/bootstrap.py (rev 0)
+++ z3c.setuptools_mercurial/trunk/bootstrap.py 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
Property changes on: z3c.setuptools_mercurial/trunk/bootstrap.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: z3c.setuptools_mercurial/trunk/buildout.cfg
===================================================================
--- z3c.setuptools_mercurial/trunk/buildout.cfg (rev 0)
+++ z3c.setuptools_mercurial/trunk/buildout.cfg 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,23 @@
+[buildout]
+develop = .
+parts = test coverage-test coverage-report python
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.setuptools_mercurial [test]
+
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = z3c.setuptools_mercurial [test]
+defaults = ['--coverage', '../../coverage']
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')
+
+[python]
+recipe = zc.recipe.egg
+eggs = z3c.setuptools_mercurial
+interpreter = py
Added: z3c.setuptools_mercurial/trunk/setup.py
===================================================================
--- z3c.setuptools_mercurial/trunk/setup.py (rev 0)
+++ z3c.setuptools_mercurial/trunk/setup.py 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,70 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Setup
+
+$Id$
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup (
+ name='z3c.setuptools_mercurial',
+ version='1.0.0',
+ author = "Stephan Richter and the Zope Community",
+ author_email = "zope-dev at zope.org",
+ description = "Mercurial File Finder Plugin for Setuptools",
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ 'Detailed Documentation\n'
+ '**********************'
+ + '\n\n' +
+ read('src', 'z3c', 'setuptools_mercurial', 'README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ license = "ZPL 2.1",
+ keywords = "setuptools mercurial distribution",
+ classifiers = [
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ "Topic :: Software Development :: Version Control",
+ "Framework :: Setuptools Plugin"],
+ url = 'http://pypi.python.org/pypi/z3c.setuptools_mercurial',
+ packages = find_packages('src'),
+ include_package_data = True,
+ package_dir = {'':'src'},
+ namespace_packages = ['z3c'],
+ extras_require = dict(
+ test = [
+ 'zope.testing',],
+ ),
+ install_requires = [
+ 'setuptools',
+ ],
+ entry_points = {
+ 'setuptools.file_finders': [
+ "hg = z3c.setuptools_mercurial.finder:find_files"
+ ]
+ },
+ zip_safe = False,
+)
Property changes on: z3c.setuptools_mercurial/trunk/setup.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: z3c.setuptools_mercurial/trunk/src/z3c/__init__.py
===================================================================
--- z3c.setuptools_mercurial/trunk/src/z3c/__init__.py (rev 0)
+++ z3c.setuptools_mercurial/trunk/src/z3c/__init__.py 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,2 @@
+import pkg_resources
+pkg_resources.declare_namespace(__name__)
Property changes on: z3c.setuptools_mercurial/trunk/src/z3c/__init__.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/README.txt
===================================================================
--- z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/README.txt (rev 0)
+++ z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/README.txt 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,63 @@
+===========================================
+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.
Property changes on: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/README.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/__init__.py
===================================================================
--- z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/__init__.py (rev 0)
+++ z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/__init__.py 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1 @@
+# Make a package.
Property changes on: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/__init__.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/finder.py
===================================================================
--- z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/finder.py (rev 0)
+++ z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/finder.py 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,44 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Find all files checked into a mercurial repository.
+
+$Id$
+"""
+import logging
+import os.path
+import subprocess
+
+def find_files(dirname="."):
+ """Find all files checked into a mercurial repository."""
+ dirname = os.path.abspath(dirname)
+ try:
+ # List all files of the repository as absolute paths.
+ proc = subprocess.Popen(['hg', 'locate', '-f'],
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ cwd=dirname)
+ stdout, stderr = proc.communicate()
+ except Exception, err:
+ logging.error(str(err))
+ # If anything happens, return an empty list.
+ return []
+ # The process finished, but returned an error code.
+ if proc.returncode != 0:
+ logging.error(stderr+ ' (code %i)' %proc.returncode)
+ return []
+ # The process finished successfully, so let's use the result. Only select
+ # those files that really belong to the passed in directory.
+ return [path.replace(dirname, '.')
+ for path in stdout.splitlines()
+ if path.startswith(dirname)]
Property changes on: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/finder.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/tests.py
===================================================================
--- z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/tests.py (rev 0)
+++ z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/tests.py 2009-12-16 02:10:27 UTC (rev 106612)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__ = "reStructuredText"
+import logging
+import os
+import unittest
+from zope.testing import doctest
+from zope.testing.doctestunit import DocFileSuite
+
+class TestingHandler(logging.Handler):
+
+ def emit(self, record):
+ print record.msg
+
+handler = TestingHandler()
+
+def do_cmd(cmd):
+ os.system(cmd)
+
+def setUp(test):
+ logging.getLogger().addHandler(handler)
+
+def tearDown(test):
+ logging.getLogger().removeHandler(handler)
+
+def test_suite():
+ return unittest.TestSuite((
+ DocFileSuite(
+ 'README.txt',
+ globs={'cmd': do_cmd},
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+ ),
+ ))
Property changes on: z3c.setuptools_mercurial/trunk/src/z3c/setuptools_mercurial/tests.py
___________________________________________________________________
Added: svn:keywords
+ Id
More information about the checkins
mailing list