# Path: subuserlib/classes/user.py
# class LockedUser():
#   def __init__(self,name=None,homeDir=None):
#     self.lock = None
#     self.__user = User(name=name,homeDir=homeDir,_locked=True)
# 
#   def __enter__(self):
#     try:
#       self.__user.endUser.makedirs(self.__user.config["lock-dir"])
#     except OSError as exception:
#       if exception.errno != errno.EEXIST:
#         raise
#     try:
#       self.lock = subuserlib.lock.getLock(self.__user.endUser.get_file(os.path.join(self.__user.config["lock-dir"],"registry.lock"),'w'),timeout=1)
#       self.lock.__enter__()
#     except IOError as e:
#       if e.errno != errno.EINTR:
#         raise e
#       sys.exit("Another subuser process is currently running and has a lock on the registry. Please try again later.")
#     return self.__user
# 
#   def __exit__(self, type, value, traceback):
#     self.lock.__exit__()


import sys
import optparse
import subuserlib.commandLineArguments
import subuserlib.update
import subuserlib.profile
from subuserlib.classes.user import LockedUser
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#external imports
#internal imports

#####################################################################################

def parseCliArgs(realArgs):
  usage = "usage: subuser update [options]"
  description = """Update subuser images.

  all
      Updates all subuser images which have been marked as out of date.

  EXAMPLE:
    $ subuser update all

  subusers

# Path: subuserlib/classes/user.py
# class LockedUser():
#   def __init__(self,name=None,homeDir=None):
#     self.lock = None
#     self.__user = User(name=name,homeDir=homeDir,_locked=True)
# 
#   def __enter__(self):
#     try:
#       self.__user.endUser.makedirs(self.__user.config["lock-dir"])
#     except OSError as exception:
#       if exception.errno != errno.EEXIST:
#         raise
#     try:
#       self.lock = subuserlib.lock.getLock(self.__user.endUser.get_file(os.path.join(self.__user.config["lock-dir"],"registry.lock"),'w'),timeout=1)
#       self.lock.__enter__()
#     except IOError as e:
#       if e.errno != errno.EINTR:
#         raise e
#       sys.exit("Another subuser process is currently running and has a lock on the registry. Please try again later.")
#     return self.__user
# 
#   def __exit__(self, type, value, traceback):
#     self.lock.__exit__()


# Path: subuserlib/builtInCommands/update.py
import sys
import optparse
import subuserlib.commandLineArguments
import subuserlib.update
import subuserlib.profile
from subuserlib.classes.user import LockedUser

#!/usr/bin/python3
# -*- coding: utf-8 -*-
#external imports
#internal imports

#####################################################################################

def parseCliArgs(realArgs):
  usage = "usage: subuser update [options]"
  description = """Update subuser images.

  all
      Updates all subuser images which have been marked as out of date.

  EXAMPLE:
    $ subuser update all

  subusers

      Updates the specified subusers