Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / examples / python / exec-basic / exec-basic.py
index 60e0bf6..579c3f4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2019. The SimGrid Team. All rights reserved.
+# Copyright (c) 2018-2020. The SimGrid Team. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
@@ -30,13 +30,11 @@ def privileged():
     # quite quickly.
 
 
-i = 0
-if "--" in sys.argv:
-    i = sys.argv.index("--")
-e = Engine(sys.argv[0:i])
-e.load_platform(sys.argv[i + 1])
+if __name__ == '__main__':
+    e = Engine(sys.argv)
+    e.load_platform(sys.argv[1])
 
-Actor.create("executor", Host.by_name("Tremblay"), executor)
-Actor.create("privileged", Host.by_name("Tremblay"), privileged)
+    Actor.create("executor", Host.by_name("Tremblay"), executor)
+    Actor.create("privileged", Host.by_name("Tremblay"), privileged)
 
-e.run()
+    e.run()