Merge pull request #2 from BrianPetkovsek/master

Added uninstall function to setup
This commit is contained in:
Brian Petkovsek 2019-06-17 12:06:43 -04:00 committed by GitHub
commit e6d865a80d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,6 +89,7 @@ class Video2xSetup:
def _install_python_requirements(self):
""" Read requirements.txt and return its content
"""
pip_uninstall('requirements.txt')
pip_install('requirements.txt')
def _cleanup(self):
@ -209,6 +210,13 @@ def pip_install(file):
"""
return subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', '-r', file]).returncode
def pip_uninstall(file):
""" Uninstall python package via python pip module
pip.main() is not available after pip 9.0.1, thus
pip module is not used in this case.
"""
return subprocess.run([sys.executable, '-m', 'pip', 'uninstall', '-r', file, '-y']).returncode
if __name__ == '__main__':
try: