mirror of
https://github.com/QuasarApp/installer-framework.git
synced 2025-05-13 21:39:33 +00:00
- also removed some unused projects under examples(updater, updaterplugin) - adjusted pro files to the new structure
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import os, time
|
|
|
|
class Installer:
|
|
def __init__( self, path, platform, location, timestamp=None, tempfile=None ):
|
|
self.path = path
|
|
self.platform = platform
|
|
self.error = None
|
|
self.timestamp = timestamp
|
|
self.tempfile = tempfile
|
|
self.sourceLocation = location
|
|
|
|
def markAsTested( self ):
|
|
self.sourceLocation.markAsTested( self.sourceFilename )
|
|
|
|
class Source:
|
|
def __init__( self ):
|
|
self._dummies = []
|
|
|
|
def nextInstaller( self ):
|
|
if len( self._dummies ) == 0:
|
|
return None
|
|
delay, path = self._dummies.pop()
|
|
time.sleep( delay )
|
|
if os.path.exists( path ):
|
|
inst = Installer( path, "linux", None )
|
|
inst.sourceFilename = path
|
|
return inst
|
|
else:
|
|
inst = Installer( None, None )
|
|
#simulating download errors
|
|
inst.error = "Installer '{0}' does not exist".format( path )
|
|
return inst
|
|
|
|
def addDummy( self, delay, path ):
|
|
self._dummies.insert( 0, ( delay, path ) )
|