Skip to content

Commit

Permalink
Version 1.18.4 - bug while deleting downloaded files - using shutils …
Browse files Browse the repository at this point in the history
…instead of subprocess
  • Loading branch information
Javinator9889 committed May 18, 2018
1 parent 2f82fd5 commit 45374e3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@
A Python tool for upgrade your kernel safely from https://kernel.org


[![PyPi](https://img.shields.io/badge/v1.18.3%20-PyPi-green.svg)](https://pypi.org/project/KernelUpgrader/)
[![PyPi](https://img.shields.io/badge/v1.18.4%20-PyPi-green.svg)](https://pypi.org/project/KernelUpgrader/)
[![ZIP](https://img.shields.io/badge/Package%20-Zip-green.svg)](https://github.com/Javinator9889/KernelUpgrader/archive/master.zip)
[![GIT](https://img.shields.io/badge/Package%20-Git-green.svg)](https://github.com/Javinator9889/KernelUpgrader.git)

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -3,7 +3,7 @@ KernelUpgrader

A Python tool for upgrade your kernel safely from https://kernel.org

.. image :: https://img.shields.io/badge/v1.18.3%20-PyPi-green.svg
.. image :: https://img.shields.io/badge/v1.18.4%20-PyPi-green.svg
:target: https://pypi.org/project/KernelUpgrader/
:alt: PyPi
.. image :: https://img.shields.io/badge/Package%20-Zip-green.svg
Expand Down
18 changes: 9 additions & 9 deletions kernel_upgrader/utils/__init__.py
Expand Up @@ -122,20 +122,20 @@ def isRunningInBackground():


def cleanupSpace():
import subprocess
import logging
from kernel_upgrader.values.Constants import C_CLEAN_DOWNLOADS, LOG_KERNEL
import shutil
from kernel_upgrader.values.Constants import LOG_KERNEL
from kernel_upgrader.utils.colors import OutputColors as Colors

command = C_CLEAN_DOWNLOADS.format(getHomeDir() + "/*")
clean_process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
clean_process.communicate()
return_code = clean_process.returncode
if return_code != 0:
try:
shutil.rmtree(getHomeDir(), ignore_errors=True)
except OSError as e:
log = logging.getLogger(LOG_KERNEL)
log.error("There was an error while trying to clean data in \"" + getHomeDir() + "\"")
log.error("There was an error while trying to clean data in \"" + getHomeDir() + "\". More info: " + str(e))
raise RuntimeError(Colors.FAIL + "We were not able to clean data in \"" + getHomeDir() + "\". Please, clean it"
" up manually"
" up manually.\n"
"More info available "
"on logs"
+ Colors.ENDC)


Expand Down
3 changes: 1 addition & 2 deletions kernel_upgrader/values/Constants.py
Expand Up @@ -16,7 +16,6 @@
C_CLEAN_KERNELS = "dpkg -l 'linux-*' | sed '/^ii/!d;/'\"$(uname -r " \
"| sed \"s/\(.*\)-\([^0-9]\+\)/\1/\")\"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' " \
"| xargs apt-get -y purge"
C_CLEAN_DOWNLOADS = "rm -r {}"

# Log params
LOG_KERNEL = "kernel_logging"
Expand All @@ -38,7 +37,7 @@

# Other params
OP_REPO_URL = "https://goo.gl/ZJ4zP9"
OP_VERSION = "1.18.3"
OP_VERSION = "1.18.4"
OP_VERSION_RAW = "https://github.com/Javinator9889/KernelUpgrader/raw/master/version.json"

# Program extended usage
Expand Down
Binary file modified version.json
Binary file not shown.

0 comments on commit 45374e3

Please sign in to comment.