+++ /dev/null
-#! /usr/bin/env python
-"""cmp.py: compare two files. Portable replacement for cmp."""
-
-import os
-import sys
-
-if sys.argv[1] in ("-h", "--help"):
- print("Broytman cmp.py 1.0, Copyright (C) 2003-2017 PhiloSoft Design")
- print("Usage: cmp.py [-h|--help|-V|--version] [-i] file1 file2")
- sys.exit()
-elif sys.argv[1] in ("-V", "--version"):
- print("Broytman cmp.py 1.0, Copyright (C) 2003-2017 PhiloSoft Design")
- sys.exit()
-elif sys.argv[1] == "-i":
- show_pbar = False
- fname1 = sys.argv[2]
- fname2 = sys.argv[3]
-else:
- show_pbar = sys.stderr.isatty()
- fname1 = sys.argv[1]
- fname2 = sys.argv[2]
-
-if show_pbar:
- try:
- from m_lib.pbar.tty_pbar import ttyProgressBar
- except ImportError:
- show_pbar = 0
-
-if show_pbar:
- try:
- size = os.path.getsize(fname1)
- except:
- print(fname1, ": no such file")
- sys.exit(1)
-
-if show_pbar:
- pbar = ttyProgressBar(0, size)
-
-file1 = open(fname1, 'rb')
-file2 = open(fname2, 'rb')
-
-M = 1024*1024
-diff = False
-count = 0
-
-
-def report():
- if show_pbar:
- global pbar
- del pbar
- sys.stderr.write("Files differ at %d megabayte block\n" % count)
- global diff
- diff = True
-
-
-while True:
- block1 = file1.read(M)
- block2 = file2.read(M)
-
- if show_pbar:
- pbar.display(file1.tell())
-
- if block1 and block2:
- if len(block1) != len(block2):
- report()
- break
- elif block1:
- report()
- break
- elif block2:
- report()
- break
- else:
- break
-
- if block1 != block2:
- report()
- break
-
- count += 1
-
-if show_pbar and not diff:
- del pbar
-
-file1.close()
-file2.close()
-
-if diff:
- sys.exit(1)
+++ /dev/null
-#! /usr/bin/env python
-
-import os
-import sys
-
-for filename in sys.argv[1:]:
- os.unlink(filename)
* Test at Travis and AppVeyor.
+* Use Portable Python Utilities.
+
Version 0.1.2 (2017-04-27)
--------------------------
SQLObject>=3.0.0; python_version >= '3.4'
m_lib.defenc>=1.0
m_lib>=3.1
+ppu
kw = {}
if is_setuptools:
kw['install_requires'] = [
- 'sqlparse', 'SQLObject>=2.2.1', 'm_lib.defenc>=1.0', 'm_lib>=3.1',
+ 'sqlparse', 'SQLObject>=2.2.1',
+ 'm_lib.defenc>=1.0', 'm_lib>=3.1',
+ 'ppu'
]
setup(name='sqlconvert',
{envpython} --version
{envpython} -c "import struct; print(struct.calcsize('P') * 8)"
deps =
- sqlparse
pytest
pytest-cov
py26: argparse
+ sqlparse
py2{6,7}: SQLObject>=2.2.1
py3{4,5,6}: SQLObject>=3.0.0
m_lib>=3.1
m_lib.defenc>=1.0
+ ppu
postgres: psycopg2
sitepackages = True
# Don't fail or warn on uninstalled commands
{[testenv]commands}
{envpython} -m pytest --cov=sqlconvert
{envpython} {envbindir}/mysql2sql -P demo/demo.sql test.out
- {envpython} devscripts/cmp.py -i tests/mysql2sql/test.out test.out
- {envpython} devscripts/rm.py test.out
+ {envpython} {envbindir}/cmp.py -i tests/mysql2sql/test.out test.out
+ {envpython} {envbindir}/rm.py test.out
[testenv:py26]
commands = {[general]commands}
commands =
{[testenv]commands}
{envpython} -m pytest --cov=sqlconvert -D sqlite:///tmp/test.sqdb
- {envpython} devscripts/rm.py /tmp/test.sqdb
+ {envpython} {envbindir}/rm.py /tmp/test.sqdb
[testenv:py26-sqlite]
commands = {[sqlite]commands}