mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-12-23 19:12:16 +03:00
util.py remove_package added
This commit is contained in:
parent
0dc279d961
commit
eed683fabf
2 changed files with 19 additions and 5 deletions
|
@ -201,10 +201,26 @@ class Util:
|
|||
raise
|
||||
|
||||
@staticmethod
|
||||
def install_with_apt_get(package_name):
|
||||
def install_with_apt_get(package_name, package_version=None):
|
||||
try:
|
||||
process = subprocess.Popen('apt-get install --yes --force-yes ' + package_name, shell=True)
|
||||
process.wait()
|
||||
if package_version is not None:
|
||||
process = subprocess.Popen('apt-get install --yes --force-yes {0}={1}'.format(package_name, package_version), shell=True)
|
||||
process.wait()
|
||||
else:
|
||||
process = subprocess.Popen('apt-get install --yes --force-yes {0}'.format(package_name), shell=True)
|
||||
process.wait()
|
||||
except:
|
||||
raise
|
||||
|
||||
@staticmethod
|
||||
def uninstall_package(package_name, package_version=None):
|
||||
try:
|
||||
if package_version is not None:
|
||||
process = subprocess.Popen('apt-get purge --yes --force-yes {0}={1}'.format(package_name, package_version), shell=True)
|
||||
process.wait()
|
||||
else:
|
||||
process = subprocess.Popen('apt-get purge --yes --force-yes {0}'.format(package_name), shell=True)
|
||||
process.wait()
|
||||
except:
|
||||
raise
|
||||
|
||||
|
@ -267,4 +283,3 @@ class Util:
|
|||
command = "sudo apt-get --yes --force-yes purge {0}={1}".format(package_name, package_version)
|
||||
result_code, p_out, p_err = Util.execute(command)
|
||||
return result_code, p_out, p_err
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/home/cemre/git/lider-ahenk-package-manager-plugin/ahenk-package-manager/package-manager
|
Loading…
Reference in a new issue