Initial commit for test cases python3 porting

This commit is contained in:
surbhicis 2020-12-22 21:55:01 +05:30
parent 9fe4ad0489
commit a4bd40e8c6
Signed by untrusted user: surbhicis
GPG Key ID: 48A8C2D218DE7B0B
2 changed files with 33 additions and 23 deletions

View File

@ -46,13 +46,13 @@ def print_results(results, top, verbose, details):
"""Print an item with the appropriate verbosity / detail"""
if verbose and results:
print ''.join(
print(''.join(
[
os.linesep,
'total pycodestyle flake8 pylint path_to_file',
os.linesep,
]
)
))
for item in sort_and_slice(results, top):
@ -66,23 +66,23 @@ def print_results(results, top, verbose, details):
)
else:
line = item['path_to_file']
print line
print(line)
if details:
print "pycodestyle:"
print("pycodestyle:")
for detail in flatten(item['pycodestyle_violations']):
print detail
print
print(detail)
print()
print "flake8:"
print("flake8:")
for detail in flatten(item['flake8_violations']):
print detail
print
print(detail)
print()
print "pylint:"
print("pylint:")
for detail in flatten(item['pylint_violations']):
print detail
print
print(detail)
print()
def sort_and_slice(results, top):
@ -107,7 +107,7 @@ def generate_file_list(filename):
if filename:
filename = os.path.abspath(filename)
if not os.path.exists(filename):
print "Bad filename, specify a Python file"
print("Bad filename, specify a Python file")
sys.exit(1)
else:
file_list = [filename]
@ -303,7 +303,7 @@ def push_docs(path=None):
)
result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT))
if result.return_code:
print 'Linking the new release failed'
print('Linking the new release failed')
# More assumptions
sudo('systemctl restart apache2')

View File

@ -24,6 +24,17 @@ EXTRAS_REQUIRE = {
'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):
def run(self):
@ -49,7 +60,7 @@ if __name__ == "__main__":
with open(os.path.join(here, 'README.md')) as f:
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())
bitmsghash = Extension(
@ -61,8 +72,8 @@ if __name__ == "__main__":
installRequires = []
packages = [
'pybitmessage',
'pybitmessage.bitmessageqt',
'pybitmessage.bitmessagecurses',
# 'pybitmessage.bitmessageqt',
# 'pybitmessage.bitmessagecurses',
'pybitmessage.fallback',
'pybitmessage.messagetypes',
'pybitmessage.network',
@ -80,7 +91,6 @@ if __name__ == "__main__":
"msgpack-python" if msgpack.version[:2] == (0, 4) else "msgpack")
except ImportError:
try:
import umsgpack
installRequires.append("umsgpack")
except ImportError:
packages += ['pybitmessage.fallback.umsgpack']
@ -108,11 +118,11 @@ if __name__ == "__main__":
long_description=README,
license='MIT',
# TODO: add author info
#author='',
#author_email='',
# author='',
# author_email='',
url='https://bitmessage.org',
# TODO: add keywords
#keywords='',
# keywords='',
install_requires=installRequires,
tests_require=requirements,
extras_require=EXTRAS_REQUIRE,
@ -127,7 +137,7 @@ if __name__ == "__main__":
package_dir={'pybitmessage': 'src'},
packages=packages,
package_data={'': [
'bitmessageqt/*.ui', 'bitmsghash/*.cl', 'sslkeys/*.pem',
'sslkeys/*.pem',
'translations/*.ts', 'translations/*.qm',
'images/*.png', 'images/*.ico', 'images/*.icns'
]},
@ -160,7 +170,7 @@ if __name__ == "__main__":
'pybitmessage = pybitmessage.bitmessagemain:main'
] if sys.platform[:3] == 'win' else []
},
scripts=['src/pybitmessage'],
scripts=[version_dependencies['pybitmessage_file']],
cmdclass={'install': InstallCmd},
command_options={
'build_sphinx': {