Consistency: calamares_main ==> run; global_storage => globalStorage
This commit is contained in:
parent
fb6d80ccb6
commit
beafcd9cc4
@ -120,13 +120,13 @@ PythonJob::exec()
|
||||
bp::dict calamaresNamespace = bp::extract< bp::dict >( calamaresModule.attr( "__dict__" ) );
|
||||
|
||||
calamaresNamespace[ "job" ] = CalamaresPython::PythonJobInterface( this );
|
||||
calamaresNamespace[ "global_storage" ] = bp::ptr( JobQueue::instance()->globalStorage() );
|
||||
calamaresNamespace[ "globalStorage" ] = bp::ptr( JobQueue::instance()->globalStorage() );
|
||||
|
||||
bp::object result = bp::exec_file( scriptFI.absoluteFilePath().toLocal8Bit().data(),
|
||||
scriptNamespace,
|
||||
scriptNamespace );
|
||||
|
||||
bp::object entryPoint = scriptNamespace[ "calamares_main" ];
|
||||
bp::object entryPoint = scriptNamespace[ "run" ];
|
||||
|
||||
QString message = QString::fromStdString( bp::extract< std::string >( entryPoint() ) );
|
||||
|
||||
|
@ -21,7 +21,7 @@ import libcalamares
|
||||
import os
|
||||
from time import gmtime, strftime
|
||||
|
||||
def calamares_main():
|
||||
def run():
|
||||
os.system( "/bin/sh -c \"touch ~/calamares-dummypython\"" )
|
||||
accumulator = strftime( "%Y-%m-%d %H:%M:%S", gmtime() ) + "\n"
|
||||
accumulator += "Calamares version: " + libcalamares.shortVersion + "\n"
|
||||
@ -29,16 +29,16 @@ def calamares_main():
|
||||
accumulator += "This job's path: " + libcalamares.job.workingPath + "\n"
|
||||
accumulator += str( libcalamares.job.configuration )
|
||||
accumulator += " *** GlobalStorage test ***\n"
|
||||
accumulator += "lala: " + str( libcalamares.global_storage.contains( "lala" ) ) + "\n"
|
||||
accumulator += "foo: " + str( libcalamares.global_storage.contains( "foo" ) ) + "\n"
|
||||
accumulator += "count: " + str( libcalamares.global_storage.count() ) + "\n"
|
||||
libcalamares.global_storage.insert( "item2", "value2" )
|
||||
libcalamares.global_storage.insert( "item3", 3 )
|
||||
accumulator += "keys: " + str( libcalamares.global_storage.keys() ) + "\n"
|
||||
accumulator += "remove: " + str( libcalamares.global_storage.remove( "item2" ) ) + "\n"
|
||||
accumulator += "values: " + str( libcalamares.global_storage.value( "foo" ) )+ " "\
|
||||
+ str( libcalamares.global_storage.value( "item2" ) ) + " "\
|
||||
+ str( libcalamares.global_storage.value( "item3" ) ) + "\n"
|
||||
accumulator += "lala: " + str( libcalamares.globalStorage.contains( "lala" ) ) + "\n"
|
||||
accumulator += "foo: " + str( libcalamares.globalStorage.contains( "foo" ) ) + "\n"
|
||||
accumulator += "count: " + str( libcalamares.globalStorage.count() ) + "\n"
|
||||
libcalamares.globalStorage.insert( "item2", "value2" )
|
||||
libcalamares.globalStorage.insert( "item3", 3 )
|
||||
accumulator += "keys: " + str( libcalamares.globalStorage.keys() ) + "\n"
|
||||
accumulator += "remove: " + str( libcalamares.globalStorage.remove( "item2" ) ) + "\n"
|
||||
accumulator += "values: " + str( libcalamares.globalStorage.value( "foo" ) )+ " "\
|
||||
+ str( libcalamares.globalStorage.value( "item2" ) ) + " "\
|
||||
+ str( libcalamares.globalStorage.value( "item3" ) ) + "\n"
|
||||
|
||||
libcalamares.job.setprogress( 0.1 )
|
||||
return accumulator
|
||||
|
@ -2,7 +2,7 @@
|
||||
syntax: "YAML map of anything"
|
||||
example:
|
||||
whats_this: "fake global storage contents"
|
||||
from_where: "global_storage.yaml"
|
||||
from_where: "globalStorage.yaml"
|
||||
a_list:
|
||||
- "item1"
|
||||
- "item2"
|
||||
@ -15,4 +15,4 @@ a_list_of_maps:
|
||||
- "another element"
|
||||
- name: "another item"
|
||||
contents:
|
||||
- "not much"
|
||||
- "not much"
|
@ -68,9 +68,9 @@ def installGrub( rootMountPoint, bootLoader ):
|
||||
chroot_call( rootMountPoint, [ "grub-mkconfig", "-o", "/boot/grub/grub.cfg" ] )
|
||||
|
||||
|
||||
def calamares_main():
|
||||
rootMountPoint = libcalamares.global_storage.value( "rootMountPoint" )
|
||||
bootLoader = libcalamares.global_storage.value( "bootLoader" )
|
||||
def run():
|
||||
rootMountPoint = libcalamares.globalStorage.value( "rootMountPoint" )
|
||||
bootLoader = libcalamares.globalStorage.value( "bootLoader" )
|
||||
extraMounts = libcalamares.job.configuration[ "extraMounts" ]
|
||||
mountPartitions( rootMountPoint, extraMounts )
|
||||
try:
|
||||
|
@ -52,13 +52,13 @@ def mountPartitions( rootMountPoint, partitions ):
|
||||
)
|
||||
|
||||
|
||||
def calamares_main():
|
||||
def run():
|
||||
rootMountPoint = tempfile.mkdtemp( prefix="calamares-root-" )
|
||||
partitions = libcalamares.global_storage.value( "partitions" )
|
||||
partitions = libcalamares.globalStorage.value( "partitions" )
|
||||
|
||||
# Sort by mount points to ensure / is mounted before the rest
|
||||
partitions.sort( key = lambda x: x[ "mountPoint" ] )
|
||||
mountPartitions( rootMountPoint, libcalamares.global_storage.value( "partitions" ) )
|
||||
mountPartitions( rootMountPoint, libcalamares.globalStorage.value( "partitions" ) )
|
||||
|
||||
libcalamares.global_storage.insert( "rootMountPoint", rootMountPoint )
|
||||
libcalamares.globalStorage.insert( "rootMountPoint", rootMountPoint )
|
||||
return "All done, mounted at {}".format( rootMountPoint )
|
||||
|
@ -30,6 +30,7 @@ except ImportError:
|
||||
raise
|
||||
|
||||
|
||||
|
||||
class Job:
|
||||
def __init__( self, workingPath, doc ):
|
||||
self.prettyName = "Testing job " + doc[ "name" ]
|
||||
@ -37,7 +38,8 @@ class Job:
|
||||
self.configuration = doc[ "configuration" ]
|
||||
|
||||
def setprogress( self, progress ):
|
||||
print ( "Job set progress to {}%.".format( progress * 100 ) )
|
||||
print( "Job set progress to {}%.".format( progress * 100 ) )
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
@ -59,21 +61,21 @@ def main():
|
||||
return 1
|
||||
|
||||
libcalamares.job = Job( args.moduledir, doc )
|
||||
libcalamares.global_storage = libcalamares.GlobalStorage()
|
||||
libcalamares.globalStorage = libcalamares.GlobalStorage()
|
||||
|
||||
# if a file for simulating global_storage contents is provided, load it
|
||||
# if a file for simulating globalStorage contents is provided, load it
|
||||
if args.globalstorage_yaml:
|
||||
with open( args.globalstorage_yaml ) as f:
|
||||
doc = yaml.load( f )
|
||||
for key, value in doc.items():
|
||||
libcalamares.global_storage.insert( key, value )
|
||||
libcalamares.globalStorage.insert( key, value )
|
||||
|
||||
scriptpath = os.path.abspath( args.moduledir )
|
||||
sys.path.append( scriptpath )
|
||||
import main
|
||||
|
||||
print( "Output from module:" )
|
||||
print( main.calamares_main() )
|
||||
print( main.run() )
|
||||
|
||||
return 0
|
||||
|
||||
|
@ -32,8 +32,8 @@ def listMounts( rootMountPoint ):
|
||||
return lst
|
||||
|
||||
|
||||
def calamares_main():
|
||||
rootMountPoint = libcalamares.global_storage.value( "rootMountPoint" )
|
||||
def run():
|
||||
rootMountPoint = libcalamares.globalStorage.value( "rootMountPoint" )
|
||||
if not rootMountPoint:
|
||||
return "GlobalStorage does not contain a \"rootMountPoint\" key, doing nothing"
|
||||
if not os.path.exists( rootMountPoint ):
|
||||
|
Loading…
Reference in New Issue
Block a user