Re: [Zope-dev] Porting zope.dottedname to Python 3

2013-02-05 Thread Wolfgang Schnerring
Hello,

* Marius Gedminas  [2013-02-05 17:56]:
> The mailing list archive contains a lot of advice.  (If this were a wiki
> page, I'd add links to the relevant emails).  What I'm trying to do
> here is to provide a concrete example of the porting pattern discovered
> by others (especially Lennart Regebro and Tres Seaver):

Thanks for the thorough writeup!

Wolfgang

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] zope-tests - FAILED: 1, OK: 21

2013-02-05 Thread Zope tests summarizer
This is the summary for test reports received on the 
zope-tests list between 2013-02-04 00:00:00 UTC and 2013-02-05 00:00:00 UTC:

See the footnotes for test reports of unsuccessful builds.

An up-to date view of the builders is also available in our 
buildbot documentation: 
http://docs.zope.org/zopetoolkit/process/buildbots.html#the-nightly-builds

Reports received


   Successful - zopetoolkit_trunk - Build # 162
   Successful - zopetoolkit_trunk_app - Build # 145
   Zope-2.10 Python-2.4.6 : Linux
   Zope-2.11 Python-2.4.6 : Linux
   Zope-2.12 Python-2.6.8 : Linux
   Zope-2.13 Python-2.6.8 : Linux
   Zope-2.13 Python-2.7.3 : Linux
   Zope-trunk Python-2.6.8 : Linux
   Zope-trunk Python-2.7.3 : Linux
   winbot / ZODB_dev py_265_win32
   winbot / ZODB_dev py_265_win64
   winbot / ZODB_dev py_270_win32
   winbot / ZODB_dev py_270_win64
[1]winbot / z3c.recipe.paster_py_265_32
   winbot / ztk_10 py_254_win32
   winbot / ztk_10 py_265_win32
   winbot / ztk_10 py_265_win64
   winbot / ztk_11 py_254_win32
   winbot / ztk_11 py_265_win32
   winbot / ztk_11 py_265_win64
   winbot / ztk_11 py_270_win32
   winbot / ztk_11 py_270_win64

Non-OK results
--

[1]FAILED  winbot / z3c.recipe.paster_py_265_32
   https://mail.zope.org/pipermail/zope-tests/2013-February/071926.html


___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Porting zope.dottedname to Python 3

2013-02-05 Thread Marius Gedminas
This ought to be a wiki page somewhere, but since I can't even figure out how
to log in to http://wiki.zope.org, I'll settle for an email.

I'm trying to dip my toes into Python 3 migration of zope.*.  Stephan
Richter suggested I start with zope.dottedname, since it's a very
trivial package with no dependencies.

The mailing list archive contains a lot of advice.  (If this were a wiki
page, I'd add links to the relevant emails).  What I'm trying to do
here is to provide a concrete example of the porting pattern discovered
by others (especially Lennart Regebro and Tres Seaver):

- make sure you've got Python interpreters for all the interesting
  versions (2.6, 2.7, 3.2, 3.3) (duh)

- check out the sources (duh)

svn co svn+ssh://svn.zope.org/repos/main/zope.dottedname/trunk

- get the tests to pass with 'python setup.py test'

this basically means you need a
test_suite='zope.dottedname.tests.test_suite', which was already
there, and a tests_require=[...] if your tests have any
dependencies.

- get the tests to pass using tox -e py27, i.e. add a tox.ini

existing packages on github.com/zopefoundation provided examples
there; here's the one I started with for zope.dottedname:

[tox]
envlist =
py26,py27,py32,py33
# you can also add pypy because why not?

[testenv]
commands =
python setup.py test -q

- add a MANIFEST.in, because tox builds sdists and installs them into
  virtualenvs under ./.tox, and because setuptools doesn't understand
  Subversion 1.7 working trees

I used 'check-manifest --create' from https://gist.github.com/4277075

- see how the tests fail with tox -e py32 and/or py33

- decide that the easiest way to fix them for zope.dottedname would be
  to add a renormalizer

https://github.com/zopefoundation/zope.dottedname/commit/1a2440c#diff-3

Alternative (and perhaps better) strategies would include rewriting
doctests into unittests

- this adds a test dependency on zope.testing:

   + edit setup.py and add tests_require=['zope.testing'],
   + also add extras={'testing': ['zope.testing']} because
   + you need to update buildout.cfg to require zope.dottedname[zope.testing]
   + also edit tox.ini and add

   [testenv]
   deps = zope.testing

(otherwise setup.py test will unpack zope.testing et al into $PWD and
clutter your working tree)

- get the tests passing (detox is very useful here as it runs tests for
  all Pythons in parallel)

- check test coverage

I tried to get tox -e coverage working, gave up, and used the old

  python setup.py bootstrap
  bin/buildout
  bin/test --coverage=coverage

method

- update Trove classifiers in setup.py:

  'Programming Language :: Python :: 2.6',
  'Programming Language :: Python :: 2.7',
  'Programming Language :: Python :: 3.2',
  'Programming Language :: Python :: 3.3',

- update CHANGES.txt and indicate Python 3.x support

- bump version number in CHANGES.txt and setup.py to 4.0.0 to indicate
  Python 3.x support

- maybe migrate to github while you're at it

- make a release to PyPI eventually (zest.releaser FTW)


Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Git conversion with svn-all-fast-export

2013-02-05 Thread Marius Gedminas
Some minor updates:

On Mon, Feb 04, 2013 at 09:59:37PM +0200, Marius Gedminas wrote:
> The conversion process goes like this:
> 
> - write a rules.txt like this one I used for zope.dottedname:
> 
> create repository zope.dottedname
> end repository
> 
> # feel free to create multiple repositories in one go
> 
> # order of matches matters in this file
> # trailing slashes in match rules are very important

> match /
>   # skip revisions 129030, 129031 and 129032, since they're empty
>   # in my svn mirror (no files, no committer, no date) for some reason
>   # (bug in svnsync?), and they make svn-all-fast-export segfault
>   min revision 129030
>   max revision 129032
> end match

This bit doesn't work (I still get the segfault).  What works is
re-running the conversion script so it picks up the pieces.

The three missing commits are test commits in /2github, so can be safely
ignored.  Besides, I doubt your Zope mirror will have the same defect.


A more interesting thing to add to the rules is this bit:

  match /Zope3/trunk/src/zope/dottedname/
repository zope.dottedname
branch monolithic-zope3
  end match

This way you can 'git blame' and see where the code actually originated.
Just be sure not to use "branch master" here, or you'll get a big mess.

For packages created before the namegeddon you might need more rules.
http://zope3.pov.lt/trac/log/zope.dottedname is useful for finding the old
location of code (click on r75116 aka "Moving code to satellite" to see).

> match /(zope\.dottedname)/trunk/
>   repository \1
>   branch master
> end match
> 
> match /(zope\.dottedname)/branches/([^/]+)/
>   repository \1
>   branch \2
> end match
> 
> match /(zope\.dottedname)/tags/([^/]+)/
>   repository \1
>   branch refs/tags/\2
> end match
> 
> match /
>   # ignore all other projects
> end match
> 
> - run svn-all-fast-export --identity-map=authors.txt --rules=rules.txt 
> --stats \
>   /path/to/your/zope-svn-mirror
> 
> - wait a bit
> 
> The first time I ran it it took ~18 wall clock minutes 

On my laptop (faster Core i5 CPU, SSD) it takes less than 4 wall clock
minutes.

> - inspect ./zope.dottedname for sanity
> 
> I recommend tig as a very nice console-mode interactive git history 
> viewer.

'gitk --all' also works very well.

> For an example of things to inspect, e.g., there was a deleted 3.4.1 tag
> from http://zope3.pov.lt/trac/changeset/80495, which shouldn't have been
> deleted, according to http://zope3.pov.lt/trac/changeset/80499, so I've
> re-created the tag from refs/backups/r80495/tags/3.4.1 that was left by
> the conversion tool.

This bit was 'git tag 3.4.1 refs/backups/r80495/tags/3.4.1'

> - upload to github

This bit is

git remote add origin g...@github.com:zopefoundation/zope.dottedname.git
git push -u origin --all
git push origin --tags


One more step at the end:

 - Remove old code from subversion, once you're sure the conversion is
   fine:

 svn rm *
 echo 'See https://github.com/zopefoundation/zope.dottedname' > 
MOVED_TO_GITHUB
 svn add MOVED_TO_GITHUB
 svn ci -m "Moved to github"


Next I was going to add Travis CI integration, but, apparently, I need
to be an admin of the ZopeFoundation organization to set up the needed
hooks.  Hint, hint.


Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )