mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 02:45:37 -04:00
Unthreadify FileCopy in unsquashfs.
This commit is contained in:
parent
f44b8eb758
commit
c42d021b61
2 changed files with 4 additions and 14 deletions
|
@ -26,14 +26,12 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
|
|
||||||
COPY_CMD = 'rsync -ar --progress %(source)s %(dest)s'
|
COPY_CMD = 'rsync -ar --progress %(source)s %(dest)s'
|
||||||
ON_POSIX = 'posix' in sys.builtin_module_names
|
ON_POSIX = 'posix' in sys.builtin_module_names
|
||||||
|
|
||||||
|
|
||||||
class FileCopyThread( Thread ):
|
class FileCopy:
|
||||||
""" Update the value of the progress bar so that we get some movement """
|
""" Update the value of the progress bar so that we get some movement """
|
||||||
def __init__( self, source, dest, progress_cb ):
|
def __init__( self, source, dest, progress_cb ):
|
||||||
# Environment used for executing rsync properly
|
# Environment used for executing rsync properly
|
||||||
|
@ -54,13 +52,6 @@ class FileCopyThread( Thread ):
|
||||||
|
|
||||||
self.progress_cb = progress_cb
|
self.progress_cb = progress_cb
|
||||||
|
|
||||||
super( FileCopyThread, self ).__init__()
|
|
||||||
|
|
||||||
|
|
||||||
def kill( self ):
|
|
||||||
if self.process.poll() is None:
|
|
||||||
self.process.kill()
|
|
||||||
|
|
||||||
|
|
||||||
def run( self ):
|
def run( self ):
|
||||||
num_files_copied = 0
|
num_files_copied = 0
|
||||||
|
|
|
@ -22,7 +22,7 @@ import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from libcalamares import *
|
from libcalamares import *
|
||||||
from filecopy import FileCopyThread
|
from filecopy import FileCopy
|
||||||
|
|
||||||
|
|
||||||
class UnsquashOperation:
|
class UnsquashOperation:
|
||||||
|
@ -81,9 +81,8 @@ class UnsquashOperation:
|
||||||
try:
|
try:
|
||||||
subprocess.check_call( [ "mount", entry[ "source" ], entry[ "sourceDir" ], "-t", "squashfs", "-o", "loop" ] )
|
subprocess.check_call( [ "mount", entry[ "source" ], entry[ "sourceDir" ], "-t", "squashfs", "-o", "loop" ] )
|
||||||
|
|
||||||
t = FileCopyThread( entry[ "sourceDir" ], entry[ "destination" ], self.reportProgress )
|
t = FileCopy( entry[ "sourceDir" ], entry[ "destination" ], self.reportProgress )
|
||||||
t.start()
|
t.run()
|
||||||
t.join()
|
|
||||||
finally:
|
finally:
|
||||||
subprocess.check_call( [ "umount", "-l", entry[ "sourceDir" ] ] )
|
subprocess.check_call( [ "umount", "-l", entry[ "sourceDir" ] ] )
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue