Initial commit for test cases python3 porting
This commit is contained in:
parent
9fe4ad0489
commit
a4bd40e8c6
|
@ -46,13 +46,13 @@ def print_results(results, top, verbose, details):
|
||||||
"""Print an item with the appropriate verbosity / detail"""
|
"""Print an item with the appropriate verbosity / detail"""
|
||||||
|
|
||||||
if verbose and results:
|
if verbose and results:
|
||||||
print ''.join(
|
print(''.join(
|
||||||
[
|
[
|
||||||
os.linesep,
|
os.linesep,
|
||||||
'total pycodestyle flake8 pylint path_to_file',
|
'total pycodestyle flake8 pylint path_to_file',
|
||||||
os.linesep,
|
os.linesep,
|
||||||
]
|
]
|
||||||
)
|
))
|
||||||
|
|
||||||
for item in sort_and_slice(results, top):
|
for item in sort_and_slice(results, top):
|
||||||
|
|
||||||
|
@ -66,23 +66,23 @@ def print_results(results, top, verbose, details):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
line = item['path_to_file']
|
line = item['path_to_file']
|
||||||
print line
|
print(line)
|
||||||
|
|
||||||
if details:
|
if details:
|
||||||
print "pycodestyle:"
|
print("pycodestyle:")
|
||||||
for detail in flatten(item['pycodestyle_violations']):
|
for detail in flatten(item['pycodestyle_violations']):
|
||||||
print detail
|
print(detail)
|
||||||
print
|
print()
|
||||||
|
|
||||||
print "flake8:"
|
print("flake8:")
|
||||||
for detail in flatten(item['flake8_violations']):
|
for detail in flatten(item['flake8_violations']):
|
||||||
print detail
|
print(detail)
|
||||||
print
|
print()
|
||||||
|
|
||||||
print "pylint:"
|
print("pylint:")
|
||||||
for detail in flatten(item['pylint_violations']):
|
for detail in flatten(item['pylint_violations']):
|
||||||
print detail
|
print(detail)
|
||||||
print
|
print()
|
||||||
|
|
||||||
|
|
||||||
def sort_and_slice(results, top):
|
def sort_and_slice(results, top):
|
||||||
|
@ -107,7 +107,7 @@ def generate_file_list(filename):
|
||||||
if filename:
|
if filename:
|
||||||
filename = os.path.abspath(filename)
|
filename = os.path.abspath(filename)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
print "Bad filename, specify a Python file"
|
print("Bad filename, specify a Python file")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
file_list = [filename]
|
file_list = [filename]
|
||||||
|
@ -303,7 +303,7 @@ def push_docs(path=None):
|
||||||
)
|
)
|
||||||
result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT))
|
result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT))
|
||||||
if result.return_code:
|
if result.return_code:
|
||||||
print 'Linking the new release failed'
|
print('Linking the new release failed')
|
||||||
|
|
||||||
# More assumptions
|
# More assumptions
|
||||||
sudo('systemctl restart apache2')
|
sudo('systemctl restart apache2')
|
||||||
|
|
28
setup.py
28
setup.py
|
@ -24,6 +24,17 @@ EXTRAS_REQUIRE = {
|
||||||
'docs': ['sphinx', 'sphinxcontrib-apidoc', 'm2r']
|
'docs': ['sphinx', 'sphinxcontrib-apidoc', 'm2r']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
version_dependencies = {
|
||||||
|
'requirements_file': 'requirements.txt',
|
||||||
|
'pybitmessage_file': 'src/pybitmessage'
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
version_dependencies = {
|
||||||
|
'requirements_file': 'py3_requirements.txt',
|
||||||
|
'pybitmessage_file': 'src/py3_pybitmessage'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class InstallCmd(install):
|
class InstallCmd(install):
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -49,7 +60,7 @@ if __name__ == "__main__":
|
||||||
with open(os.path.join(here, 'README.md')) as f:
|
with open(os.path.join(here, 'README.md')) as f:
|
||||||
README = f.read()
|
README = f.read()
|
||||||
|
|
||||||
with open(os.path.join(here, 'requirements.txt'), 'r') as f:
|
with open(os.path.join(here, version_dependencies['requirements_file']), 'r') as f:
|
||||||
requirements = list(f.readlines())
|
requirements = list(f.readlines())
|
||||||
|
|
||||||
bitmsghash = Extension(
|
bitmsghash = Extension(
|
||||||
|
@ -61,8 +72,8 @@ if __name__ == "__main__":
|
||||||
installRequires = []
|
installRequires = []
|
||||||
packages = [
|
packages = [
|
||||||
'pybitmessage',
|
'pybitmessage',
|
||||||
'pybitmessage.bitmessageqt',
|
# 'pybitmessage.bitmessageqt',
|
||||||
'pybitmessage.bitmessagecurses',
|
# 'pybitmessage.bitmessagecurses',
|
||||||
'pybitmessage.fallback',
|
'pybitmessage.fallback',
|
||||||
'pybitmessage.messagetypes',
|
'pybitmessage.messagetypes',
|
||||||
'pybitmessage.network',
|
'pybitmessage.network',
|
||||||
|
@ -80,7 +91,6 @@ if __name__ == "__main__":
|
||||||
"msgpack-python" if msgpack.version[:2] == (0, 4) else "msgpack")
|
"msgpack-python" if msgpack.version[:2] == (0, 4) else "msgpack")
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
import umsgpack
|
|
||||||
installRequires.append("umsgpack")
|
installRequires.append("umsgpack")
|
||||||
except ImportError:
|
except ImportError:
|
||||||
packages += ['pybitmessage.fallback.umsgpack']
|
packages += ['pybitmessage.fallback.umsgpack']
|
||||||
|
@ -108,11 +118,11 @@ if __name__ == "__main__":
|
||||||
long_description=README,
|
long_description=README,
|
||||||
license='MIT',
|
license='MIT',
|
||||||
# TODO: add author info
|
# TODO: add author info
|
||||||
#author='',
|
# author='',
|
||||||
#author_email='',
|
# author_email='',
|
||||||
url='https://bitmessage.org',
|
url='https://bitmessage.org',
|
||||||
# TODO: add keywords
|
# TODO: add keywords
|
||||||
#keywords='',
|
# keywords='',
|
||||||
install_requires=installRequires,
|
install_requires=installRequires,
|
||||||
tests_require=requirements,
|
tests_require=requirements,
|
||||||
extras_require=EXTRAS_REQUIRE,
|
extras_require=EXTRAS_REQUIRE,
|
||||||
|
@ -127,7 +137,7 @@ if __name__ == "__main__":
|
||||||
package_dir={'pybitmessage': 'src'},
|
package_dir={'pybitmessage': 'src'},
|
||||||
packages=packages,
|
packages=packages,
|
||||||
package_data={'': [
|
package_data={'': [
|
||||||
'bitmessageqt/*.ui', 'bitmsghash/*.cl', 'sslkeys/*.pem',
|
'sslkeys/*.pem',
|
||||||
'translations/*.ts', 'translations/*.qm',
|
'translations/*.ts', 'translations/*.qm',
|
||||||
'images/*.png', 'images/*.ico', 'images/*.icns'
|
'images/*.png', 'images/*.ico', 'images/*.icns'
|
||||||
]},
|
]},
|
||||||
|
@ -160,7 +170,7 @@ if __name__ == "__main__":
|
||||||
'pybitmessage = pybitmessage.bitmessagemain:main'
|
'pybitmessage = pybitmessage.bitmessagemain:main'
|
||||||
] if sys.platform[:3] == 'win' else []
|
] if sys.platform[:3] == 'win' else []
|
||||||
},
|
},
|
||||||
scripts=['src/pybitmessage'],
|
scripts=[version_dependencies['pybitmessage_file']],
|
||||||
cmdclass={'install': InstallCmd},
|
cmdclass={'install': InstallCmd},
|
||||||
command_options={
|
command_options={
|
||||||
'build_sphinx': {
|
'build_sphinx': {
|
||||||
|
|
Reference in New Issue
Block a user