dax/dax_tools_utils.py
def init_profile(host):
    """Function to init your profile file to call xnat_profile.

    :param host: Host of XNAT to add to your profile
    :return: None
    """
    # link the file in the bashrc or profile
    profile = os.path.join(os.path.expanduser('~'), '.bash_profile')

    if os.path.exists(os.path.join(os.path.expanduser('~'), '.bash_profile')):
        profile = os.path.join(os.path.expanduser('~'), '.bash_profile')
    elif os.path.exists(os.path.join(os.path.expanduser('~'), '.bashrc')):
        profile = os.path.join(os.path.expanduser('~'), '.bashrc')
    elif os.path.exists(os.path.join(os.path.expanduser('~'), '.profile')):
        profile = os.path.join(os.path.expanduser('~'), '.profile')
    else:
        raise DaxSetupError("could not find your profile file.")
    # Add the line to the profile
    line_to_add = 'export XNAT_HOST=%s' % host
    if 'XNAT_HOST' not in open(profile).read():
        with open(profile, "a") as f_profile:
            f_profile.write(BASH_PROFILE_XNAT.format(export_cmd=line_to_add))
Function to init your profile file to call xnat_profile.

    :param host: Host of XNAT to add to your profile
    :return: None
    
Function to init your profile file to call xnat_profile.
Function to init your profile file to call xnat_profile .
def init_profile(host):
    profile = os.path.join(os.path.expanduser('~'), '.bash_profile')
    if os.path.exists(os.path.join(os.path.expanduser('~'), '.bash_profile')):
        profile = os.path.join(os.path.expanduser('~'), '.bash_profile')
    elif os.path.exists(os.path.join(os.path.expanduser('~'), '.bashrc')):
        profile = os.path.join(os.path.expanduser('~'), '.bashrc')
    elif os.path.exists(os.path.join(os.path.expanduser('~'), '.profile')):
        profile = os.path.join(os.path.expanduser('~'), '.profile')
    else:
        raise DaxSetupError("could not find your profile file.")
    line_to_add = 'export XNAT_HOST=%s' % host
    if 'XNAT_HOST' not in open(profile).read():
        with open(profile, "a") as f_profile:
            f_profile.write(BASH_PROFILE_XNAT.format(export_cmd=line_to_add))
def init_profile ( host ) : profile = os . path . join ( os . path . expanduser ( '~' ) , '.bash_profile' ) if os . path . exists ( os . path . join ( os . path . expanduser ( '~' ) , '.bash_profile' ) ) : profile = os . path . join ( os . path . expanduser ( '~' ) , '.bash_profile' ) elif os . path . exists ( os . path . join ( os . path . expanduser ( '~' ) , '.bashrc' ) ) : profile = os . path . join ( os . path . expanduser ( '~' ) , '.bashrc' ) elif os . path . exists ( os . path . join ( os . path . expanduser ( '~' ) , '.profile' ) ) : profile = os . path . join ( os . path . expanduser ( '~' ) , '.profile' ) else : raise DaxSetupError ( "could not find your profile file." ) line_to_add = 'export XNAT_HOST=%s' % host if 'XNAT_HOST' not in open ( profile ) . read ( ) : with open ( profile , "a" ) as f_profile : f_profile . write ( BASH_PROFILE_XNAT . format ( export_cmd = line_to_add ) )
Function to init your profile file to call xnat_profile.
Function to init your profile file to call xnat_profile .
"""Function to init your profile file to call xnat_profile.

    :param host: Host of XNAT to add to your profile
    :return: None
    """ # link the file in the bashrc or profile # Add the line to the profile
None
host
Host of XNAT to add to your profile
Host of XNAT to add to your profile