Code review comment for lp:~oubiwann/txgenshi/506281-util-cleanup

Revision history for this message
Cory Dodt (corydodt) wrote :

Any idea why I see this?

cdodt 0 ~/wc/txGenshi% *bzr merge lp:~oubiwann/txgenshi/506281-util-cleanup*
bzr: ERROR:
KnitPackRepository('file:///home/cdodt/wc/txGenshi/.bzr/repository/')
is not compatible with
RemoteRepository(bzr+ssh://
bazaar.launchpad.net/~oubiwann/txgenshi/506281-util-cleanup/.bzr/)
different rich-root support

I actually have something a bit like a test for your setup if you squint.
 I'm working on a Nevow-based framework called Chichimec, and it uses
virtualenv to build directories where Chichimec--and its dependencies,
including txGenshi--is installed. Then it runs tests inside the directory
that it generates. So indirectly it is a test of Chichimec's setup.
 Unfortunately the above error is blocking me (I could just patch, of
course, but it's late and I'd rather know what the error means).

From scanning the patch, I noticed there is a merge conflict marker stuck in
there, and it looks like __init__.py should have a docstring now. There may
be other modules that need them, perhaps that's a chore for your other bug
:-)

C

On Tue, Jan 12, 2010 at 12:12 AM, Duncan McGreggor <email address hidden>wrote:

> Duncan McGreggor has proposed merging
> lp:~oubiwann/txgenshi/506281-util-cleanup into lp:txgenshi.
>
> Requested reviews:
> Cory Dodt (corydodt)
> Related bugs:
> #506281 Cleanup txgenshi.util
> https://bugs.launchpad.net/bugs/506281
>
>
> Okay, I did some cleanup of the util module, dist code, project metadata,
> and setup.py.
> --
>
> https://code.launchpad.net/~oubiwann/txgenshi/506281-util-cleanup/+merge/17207
> You are requested to review the proposed merge of
> lp:~oubiwann/txgenshi/506281-util-cleanup into lp:txgenshi.
>
> === modified file 'ChangeLog'
> --- ChangeLog 2010-01-11 00:46:46 +0000
> +++ ChangeLog 2010-01-12 08:12:15 +0000
> @@ -1,3 +1,7 @@
> +2010.10.11
> +
> +* Cleaned up and re-orged the utility code and library metadata.
> +
> 2010.01.10
>
> * Added unit tests
>
> === modified file 'README'
> --- README 2010-01-11 00:46:46 +0000
> +++ README 2010-01-12 08:12:15 +0000
> @@ -37,7 +37,7 @@
> Changes
> =======
>
> -From txGenshi nothing to 0.0.1
> -------------------------------------
> +0.0.1
> +-----
>
> *
>
> === modified file 'setup.py'
> --- setup.py 2008-07-16 23:59:58 +0000
> +++ setup.py 2010-01-12 08:12:15 +0000
> @@ -1,5 +1,28 @@
> -import txgenshi
> -from txgenshi import util
> -
> -
> -util.setup(**util.setupDict)
> +from txgenshi import meta
> +from txgenshi.util import dist
> +
> +
> +dist.setup(
> + name=meta.display_name,
> + version=meta.version,
> + description=meta.description,
> + author=meta.author,
> + author_email=meta.author_email,
> + url=meta.url,
> + license=meta.license,
> + packages=dist.findPackages(meta.library_name),
> + long_description=dist.catReST(
> + "README",
> + "DEPENDENCIES",
> + stop_on_errors=True,
> + out=True),
> + classifiers=meta.classifiers,
> + package_data={
> + 'txgenshidemo': ['demo.tac',
> + 'templates/genshimix.xhtml',
> + 'templates/genshiinclude.xhtml',
> + 'templates/home.xhtml',
> + 'templates/mystuff.xhtml',
> + 'templates/yourstuff.xhtml',
> + ]}
> + )
>
> === added file 'txgenshi/__init__.py'
> === renamed file 'txgenshi/__init__.py' => 'txgenshi/meta.py'
> --- txgenshi/__init__.py 2010-01-07 18:48:32 +0000
> +++ txgenshi/meta.py 2010-01-12 08:12:15 +0000
> @@ -1,9 +1,12 @@
> -name = 'txGenshi'
> -shortName = 'txGenshi'
> -projectURL = 'https://launchpad.net/txgenshi'
> +display_name = 'txGenshi'
> +library_name = 'txgenshi'
> summary = 'txGenshi: Twisted-Friendly Genshi Templates for Nevow'
> description = summary
> +url = 'https://launchpad.net/txgenshi'
> +author = 'Duncan McGreggor, Cory Dodt'
> +author_email = '<email address hidden>'
> version = '0.0.1'
> +license = 'MIT'
> classifiers = [
> 'Development Status :: 5 - Production/Stable',
> 'Environment :: Web Environment',
>
> === modified file 'txgenshi/test/test_util.py'
> --- txgenshi/test/test_util.py 2008-07-18 15:51:29 +0000
> +++ txgenshi/test/test_util.py 2010-01-12 08:12:15 +0000
> @@ -2,15 +2,13 @@
>
> from twisted.trial import unittest
>
> -from txgenshi import util
> +from txgenshi.util.base import boolify
>
>
> class UtilityTests(unittest.TestCase):
> """
> Test the various utility functions.
> """
> -
> -
> def test_boolify(self):
> """
> Make sure that we get the truth values we expect.
> @@ -20,7 +18,7 @@
> falses = ['no', '0', 'off', 'disable', 'false', u'no', u'0',
> u'off',
> u'disable', u'false', 'NO', 'OFF', 0, False, 'monkeyface']
> for true in trues:
> - self.assertEqual(util.boolify(true), True)
> + self.assertEqual(boolify(true), True)
> for false in falses:
> - self.assertEqual(util.boolify(false), False)
> + self.assertEqual(boolify(false), False)
>
>
> === added directory 'txgenshi/util'
> === added file 'txgenshi/util/__init__.py'
> === renamed file 'txgenshi/util.py' => 'txgenshi/util/base.py'
> --- txgenshi/util.py 2010-01-12 06:20:09 +0000
> +++ txgenshi/util/base.py 2010-01-12 08:12:15 +0000
> @@ -1,27 +1,12 @@
> -import os
> import re
> -import sys
> -import crypt
> -import getpass
>
> import txgenshi
>
> +
> privKeyFile = 'etc/server.pem'
> certFile = 'etc/server.pem'
>
>
> -def getPackageName():
> - return "%s-%s" % (txgenshi.name, txgenshi.version)
> -
> -
> -def getDistFilename():
> - return "%s.tar.gz" % getPackageName()
> -
> -
> -def getLocalDist():
> - return "dist/%s" % getDistFilename()
> -
> -
> def boolify(data):
> """
> First, see if the data adheres to common string patterns for a boolean.
> @@ -65,6 +50,7 @@
> output += nl
> output += repr(obj)
> return re.sub('\n\n', '\n', output)
> +<<<<<<< TREE
>
>
>
> @@ -215,3 +201,5 @@
> sys.argv = ['', 'build', 'sdist']
> setup(**setupDict)
> return getDistFilename()
> +=======
> +>>>>>>> MERGE-SOURCE
>
> === added file 'txgenshi/util/dist.py'
> --- txgenshi/util/dist.py 1970-01-01 00:00:00 +0000
> +++ txgenshi/util/dist.py 2010-01-12 08:12:15 +0000
> @@ -0,0 +1,133 @@
> +import os
> +import sys
> +
> +import txgenshi
> +
> +
> +def getPackageName():
> + return "%s-%s" % (txgenshi.name, txgenshi.version)
> +
> +
> +def getDistFilename():
> + return "%s.tar.gz" % getPackageName()
> +
> +
> +def getLocalDist():
> + return "dist/%s" % getDistFilename()
> +
> +
> +def setup(*args, **kwds):
> + """
> + Compatibility wrapper.
> + """
> + try:
> + from setuptools import setup
> + except ImportError:
> + from distutils.core import setup
> + return setup(*args, **kwds)
> +
> +
> +def findPackages(library_name):
> + """
> + Compatibility wrapper.
> +
> + Taken from storm setup.py.
> + """
> + try:
> + from setuptools import find_packages
> + return find_packages()
> + except ImportError:
> + pass
> + packages = []
> + for directory, subdirectories, files in os.walk(library_name):
> + if '__init__.py' in files:
> + packages.append(directory.replace(os.sep, '.'))
> + return packages
> +
> +
> +def hasDocutils():
> + """
> + Check to see if docutils is installed.
> + """
> + try:
> + import docutils
> + return True
> + except ImportError:
> + return False
> +
> +
> +def _validateReST(text):
> + """
> + Make sure that the given ReST text is valid.
> +
> + Taken from Zope Corp's zc.twist setup.py.
> + """
> + import docutils.utils
> + import docutils.parsers.rst
> + import StringIO
> +
> + doc = docutils.utils.new_document('validator')
> + # our desired settings
> + doc.reporter.halt_level = 5
> + doc.reporter.report_level = 1
> + stream = doc.reporter.stream = StringIO.StringIO()
> + # docutils buglets (?)
> + doc.settings.tab_width = 2
> + doc.settings.pep_references = doc.settings.rfc_references = False
> + doc.settings.trim_footnote_reference_space = None
> + # and we're off...
> + parser = docutils.parsers.rst.Parser()
> + parser.parse(text, doc)
> + return stream.getvalue()
> +
> +
> +def validateReST(text):
> + """
> + A wrapper that ensafens the validation for pythons that are not
> embiggened
> + with docutils.
> + """
> + if hasDocutils():
> + return _validateReST(text)
> + print " *** No docutils; can't validate ReST."
> + return ''
> +
> +
> +def catReST(*args, **kwds):
> + """
> + Concatenate the contents of one or more ReST files.
> +
> + Taken from Zope Corp's zc.twist setup.py.
> + """
> + # note: distutils explicitly disallows unicode for setup values :-/
> + # http://docs.python.org/dist/meta-data.html
> + tmp = []
> + for a in args:
> + if a in ['README', 'DEPENDENCIES'] or a.endswith('.txt'):
> + f = open(os.path.join(*a.split('/')))
> + tmp.append(f.read())
> + f.close()
> + tmp.append('\n\n')
> + else:
> + tmp.append(a)
> + if len(tmp) == 1:
> + res = tmp[0]
> + else:
> + res = ''.join(tmp)
> + out = kwds.get('out')
> + if out is True:
> + out = 'CHECK_THIS_BEFORE_UPLOAD.txt'
> + if out:
> + f = open(out, 'w')
> + f.write(res)
> + f.close()
> + report = validateReST(res)
> + if report:
> + print report
> + raise ValueError('ReST validation error')
> + return res
> +
> +
> +def buildDist():
> + sys.argv = ['', 'build', 'sdist']
> + setup(**setupDict)
> + return getDistFilename()
>
>
>

--
_____________________

« Back to merge proposal