mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-09 09:59:51 +01:00
move version check to setup.py
This commit is contained in:
parent
7deac793b5
commit
867333db87
@ -1,9 +1,4 @@
|
|||||||
import sys
|
import sys
|
||||||
from distutils.version import LooseVersion
|
|
||||||
if LooseVersion(sys.version) < LooseVersion("3.4.0"):
|
|
||||||
print("At least python 3.4.0 required. Your version is "+sys.version)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
57
setup.py
57
setup.py
@ -1,27 +1,36 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
import sys
|
||||||
|
|
||||||
setup(name='pirate-get',
|
if LooseVersion(sys.version) < LooseVersion("3.4.0"):
|
||||||
version='0.2.8',
|
print("pirate-get requires at least python 3.4.0."
|
||||||
description='A command line interface for The Pirate Bay',
|
" Your version is %s." % sys.version.split()[0])
|
||||||
url='https://github.com/vikstrous/pirate-get',
|
sys.exit(1)
|
||||||
author='vikstrous',
|
|
||||||
author_email='me@viktorstanchev.com',
|
if __name__ == '__main__':
|
||||||
license='AGPL',
|
setup(name='pirate-get',
|
||||||
packages=find_packages(),
|
version='0.2.8',
|
||||||
package_data={'': ["data/*.json"]},
|
description='A command line interface for The Pirate Bay',
|
||||||
entry_points={
|
url='https://github.com/vikstrous/pirate-get',
|
||||||
'console_scripts': ['pirate-get = pirate.pirate:main']
|
author='vikstrous',
|
||||||
},
|
author_email='me@viktorstanchev.com',
|
||||||
install_requires=['colorama>=0.3.3', 'beautifulsoup4>=4.4.1', 'veryprettytable>=0.8.1'],
|
license='AGPL',
|
||||||
keywords=['torrent', 'magnet', 'download', 'tpb', 'client'],
|
packages=find_packages(),
|
||||||
classifiers=[
|
package_data={'': ["data/*.json"]},
|
||||||
'Topic :: Utilities',
|
entry_points={
|
||||||
'Topic :: Terminals',
|
'console_scripts': ['pirate-get = pirate.pirate:main']
|
||||||
'Topic :: System :: Networking',
|
},
|
||||||
'Programming Language :: Python :: 3 :: Only',
|
install_requires=['colorama>=0.3.3',
|
||||||
'Programming Language :: Python :: 3.4',
|
'beautifulsoup4>=4.4.1',
|
||||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
'veryprettytable>=0.8.1'],
|
||||||
],
|
keywords=['torrent', 'magnet', 'download', 'tpb', 'client'],
|
||||||
test_suite='tests',
|
classifiers=[
|
||||||
)
|
'Topic :: Utilities',
|
||||||
|
'Topic :: Terminals',
|
||||||
|
'Topic :: System :: Networking',
|
||||||
|
'Programming Language :: Python :: 3 :: Only',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||||
|
],
|
||||||
|
test_suite='tests')
|
||||||
|
@ -1,37 +1,40 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
|
import os.path
|
||||||
import unittest
|
import unittest
|
||||||
import importlib
|
import importlib
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from unittest.mock import patch, call, MagicMock
|
from unittest.mock import patch, call, MagicMock
|
||||||
|
|
||||||
import pirate.pirate
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
|
||||||
|
import setup
|
||||||
|
|
||||||
class TestPirate(unittest.TestCase):
|
class TestPirate(unittest.TestCase):
|
||||||
|
|
||||||
@patch('sys.exit')
|
@patch('sys.exit')
|
||||||
def test_unsupported(self, mock_exit):
|
def test_unsupported(self, mock_exit):
|
||||||
sys.version = '3.2.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
sys.version = '3.2.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||||
importlib.reload(pirate.pirate)
|
importlib.reload(setup)
|
||||||
mock_exit.assert_called_once_with(1)
|
mock_exit.assert_called_once_with(1)
|
||||||
|
|
||||||
@patch('sys.exit')
|
@patch('sys.exit')
|
||||||
def test_unsupported2(self, mock_exit):
|
def test_unsupported2(self, mock_exit):
|
||||||
sys.version = '2.5.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
sys.version = '2.5.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||||
importlib.reload(pirate.pirate)
|
importlib.reload(setup)
|
||||||
mock_exit.assert_called_once_with(1)
|
mock_exit.assert_called_once_with(1)
|
||||||
|
|
||||||
|
|
||||||
@patch('sys.exit')
|
@patch('sys.exit')
|
||||||
def test_supported(self, mock_exit):
|
def test_supported(self, mock_exit):
|
||||||
sys.version = '3.5.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
sys.version = '3.5.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||||
importlib.reload(pirate.pirate)
|
importlib.reload(setup)
|
||||||
mock_exit.assert_not_called()
|
mock_exit.assert_not_called()
|
||||||
|
|
||||||
@patch('sys.exit')
|
@patch('sys.exit')
|
||||||
def test_supported_exact(self, mock_exit):
|
def test_supported_exact(self, mock_exit):
|
||||||
sys.version = '3.4.0 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
sys.version = '3.4.0 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||||
importlib.reload(pirate.pirate)
|
importlib.reload(setup)
|
||||||
mock_exit.assert_not_called()
|
mock_exit.assert_not_called()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user