def FindRegisterPackage(packageName, knownFile, searchPaths, registryAppName=None):
 import regutil, string
 if (not packageName):
  raise error('A package name must be supplied')
 corePaths = regutil.GetRegisteredNamedPath(None).split(';')
 if (not searchPaths):
  searchPaths = corePaths
 registryAppName = (registryAppName or packageName)
 try:
  (pathLook, pathAdd) = FindPackagePath(packageName, knownFile, searchPaths)
  if (pathAdd is not None):
   if (pathAdd in corePaths):
    pathAdd = ''
   regutil.RegisterNamedPath(registryAppName, pathAdd)
  return pathLook
 except error as details:
  print ('*** The %s package could not be registered - %s' % (packageName, details))
  print '*** Please ensure you have passed the correct paths on the command line.'
  print '*** - For packages, you should pass a path to the packages parent directory,'
  print '*** - and not the package directory itself...'

def FindRegisterPackage ( packageName , knownFile , searchPaths , registryAppName = None ) : import regutil , string if ( not packageName ) : raise error ( 'A package name must be supplied' ) corePaths = regutil . GetRegisteredNamedPath ( None ) . split ( ';' ) if ( not searchPaths ) : searchPaths = corePaths registryAppName = ( registryAppName or packageName ) try : ( pathLook , pathAdd ) = FindPackagePath ( packageName , knownFile , searchPaths ) if ( pathAdd is not None ) : if ( pathAdd in corePaths ) : pathAdd = '' regutil . RegisterNamedPath ( registryAppName , pathAdd ) return pathLook except error as details : print ( '*** The %s package could not be registered - %s' % ( packageName , details ) ) print '*** Please ensure you have passed the correct paths on the command line.' print '*** - For packages, you should pass a path to the packages parent directory,' print '*** - and not the package directory itself...'
find and register a package .