Skip to content

Commit

Permalink
[py3] only run 3to2 once from setup.py
Browse files Browse the repository at this point in the history
This leaves a file called '3to2.conversion.ok' next to setup.py after
the conversion is complete.
Also removes duplicated code in 3to2.sh
  • Loading branch information
renefritze committed May 24, 2016
1 parent 272b622 commit d939dca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -61,3 +61,4 @@ coverage.xml
libpeerconnection.log
debian/pymor/
.cache
3to2.conversion.ok
36 changes: 0 additions & 36 deletions 3to2.sh

This file was deleted.

4 changes: 4 additions & 0 deletions setup.py
Expand Up @@ -99,6 +99,9 @@ def write_version():
class build_py27(_build_py):
def __init__(self, *args, **kwargs):
_build_py.__init__(self, *args, **kwargs)
checkpoint_fn = os.path.join(os.path.dirname(__file__), '3to2.conversion.ok')
if os.path.exists(checkpoint_fn):
return
import logging
from lib2to3 import refactor
import lib3to2.main
Expand Down Expand Up @@ -130,6 +133,7 @@ def __init__(self, *args, **kwargs):
)
self.rtool.refactor_dir('src', write=True)
self.rtool.refactor_dir('docs', write=True)
open(checkpoint_fn, 'wta').write('converted')

cmdclass = {}
if sys.version_info[0] < 3:
Expand Down

0 comments on commit d939dca

Please sign in to comment.