Skip to content

Commit ad4bb6d

Browse files
committed
DEV: make makesdist script Python 3 compatible.
Add `inform` helper function for flushed print outs to stdout.
1 parent bf6f704 commit ad4bb6d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

devutils/makesdist

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ vfb = versiondata.get('DEFAULT', 'version').split('.post')[0] + '.post0'
2121
emsg = "Invalid FALLBACK_VERSION. Expected %r got %r."
2222
assert vfb == FALLBACK_VERSION, emsg % (vfb, FALLBACK_VERSION)
2323

24-
print 'Run "setup.py sdist --formats=tar"',
24+
def inform(s):
25+
sys.stdout.write(s)
26+
sys.stdout.flush()
27+
return
28+
29+
inform('Run "setup.py sdist --formats=tar" ')
2530
cmd_sdist = [sys.executable] + 'setup.py sdist --formats=tar'.split()
2631
ec = subprocess.call(cmd_sdist, cwd=BASEDIR, stdout=open(os.devnull, 'w'))
2732
if ec: sys.exit(ec)
28-
print "[done]"
33+
inform("[done]\n")
2934

3035
tarname = max(glob.glob(BASEDIR + '/dist/*.tar'), key=os.path.getmtime)
3136

@@ -40,11 +45,10 @@ def fixtarinfo(tinfo):
4045
tinfo.mode &= ~0o022
4146
return tinfo
4247

43-
44-
print 'Filter %s --> %s.gz' % (2 * (os.path.basename(tarname),)),
48+
inform('Filter %s --> %s.gz ' % (2 * (os.path.basename(tarname),)))
4549
for ti in tfin:
4650
tfout.addfile(fixtarinfo(ti), tfin.extractfile(ti))
4751

4852
tfin.close()
4953
os.remove(tarname)
50-
print "[done]"
54+
inform("[done]\n")

0 commit comments

Comments
 (0)