def require_cwd_to_be_oppia(allow_deploy_dir=False):
 is_oppia_dir = os.getcwd().endswith('oppia')
 current_dirname = os.path.basename(os.path.normpath(os.getcwd()))
 is_deploy_dir = (current_dirname.startswith('deploy-') and os.path.isdir(os.path.join(os.getcwd(), '..', 'oppia')))
 if (is_oppia_dir or (allow_deploy_dir and is_deploy_dir)):
  return
 raise Exception('Please run this script from the oppia/ directory.')

def require_cwd_to_be_oppia ( allow_deploy_dir = False ) : is_oppia_dir = os . getcwd ( ) . endswith ( 'oppia' ) current_dirname = os . path . basename ( os . path . normpath ( os . getcwd ( ) ) ) is_deploy_dir = ( current_dirname . startswith ( 'deploy-' ) and os . path . isdir ( os . path . join ( os . getcwd ( ) , '..' , 'oppia' ) ) ) if ( is_oppia_dir or ( allow_deploy_dir and is_deploy_dir ) ) : return raise Exception ( 'Please run this script from the oppia/ directory.' )
ensures that the current working directory ends in oppia .