I've been trying to install an app through admin, and it's been failing.
(Problem #1: there's no feedback at all when this happens, just a message that
the install failed; I had to run a debugger to find out why.)
It turned out that fix_newlines was raising an exception because it was trying
to write a .py file that was read-only. It was read-only because my app is
under Perforce source control, and read-only is the normal state for files not
being edited.
So when the app was packed, tar preserved the read-only state of the files, and
when fix_newlines tries to write them, kablooey.
My workaround is below: since this is a Unix system, fix_newlines isn't really
necessary. I made the rewrite conditional on there actually being a change.
Now, this is perhaps a good thing to do regardless, but of course it doesn't
solve the problem in the Windows case.
I'm not sure what the right fix is, though this one is adequate for me. Maybe
fix_newlines should make the file writable if necessary?
def fix_newlines(path):
regex = re.compile(r'''(\r
|\r|
)''')
for filename in listdir(path, '.*\.(py|html)$', drop=False):
fp = open(filename, 'rb')
rdata = fp.read()
fp.close()
wdata = regex.sub('\n', rdata)
if wdata != rdata:
fp = open(filename, 'wb')
fp.write(wdata)
fp.close()
--
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en