save point (see note)
Changed license to AGPLv3, "finished" console command framework (for now?), and added initial db/lib/pyramid/wx subpackages - though those are not yet well tested.
This commit is contained in:
parent
3d75732d36
commit
a6decbb313
36 changed files with 2910 additions and 172 deletions
|
@ -2,23 +2,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
################################################################################
|
||||
#
|
||||
# edbob -- Pythonic software framework
|
||||
# Copyright © 2010,2011,2012 Lance Edgar
|
||||
# edbob -- Pythonic Software Framework
|
||||
# Copyright © 2010-2012 Lance Edgar
|
||||
#
|
||||
# This file is part of edbob.
|
||||
#
|
||||
# edbob is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# edbob is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# edbob. If not, see <http://www.gnu.org/licenses/>.
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with edbob. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
@ -28,10 +28,31 @@
|
|||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
|
||||
__all__ = ['count_lines', 'temp_path']
|
||||
__all__ = ['change_newlines', 'count_lines', 'temp_path']
|
||||
|
||||
|
||||
def change_newlines(path, newline):
|
||||
"""
|
||||
Rewrites the file at ``path``, changing its newline character(s) to that of
|
||||
``newline``.
|
||||
"""
|
||||
|
||||
root, ext = os.path.splitext(path)
|
||||
temp_path = temp_path(suffix='.' + ext)
|
||||
infile = open(path, 'rUb')
|
||||
outfile = open(temp_path, 'wb')
|
||||
for line in infile:
|
||||
line = line.rstrip('\r\n')
|
||||
outfile.write(line + newline)
|
||||
infile.close()
|
||||
outfile.close()
|
||||
os.remove(path)
|
||||
shutil.move(temp_path, path)
|
||||
|
||||
|
||||
def count_lines(path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue