Пример #1
0
 def update_site_data_dir(sitedata, sdir, site_data_src):
     """
     Update indicated sitedata directory data from source: 
     old data for the directory that is not updated is left as-is.
     """
     site_data_tgt, site_data_file = sitedata._dir_path()
     s = os.path.join(site_data_src, sdir)
     d = os.path.join(site_data_tgt, sdir)
     updatetree(s, d)
     return
Пример #2
0
 def update_site_data_dir(sitedata, sdir, site_data_src):
     """
     Update indicated sitedata directory data from source: 
     old data for the directory that is not updated is left as-is.
     """
     site_data_tgt, site_data_file = sitedata._dir_path()
     s = os.path.join(site_data_src, sdir)
     d = os.path.join(site_data_tgt, sdir)
     updatetree(s, d)
     return
Пример #3
0
def migrate_old_data(old_site_dir, old_data_dir, new_site_dir, new_data_dir):
    """
    Migrate data from a single old-site directory to the new site
    """
    old_dir = os.path.join(old_site_dir, old_data_dir)
    new_dir = os.path.join(new_site_dir, new_data_dir)
    if os.path.isdir(old_dir):
        print("- %s +> %s (migrating)"%(old_dir, new_dir))
        updatetree(old_dir, new_dir)
        archive_old_data(old_site_dir, old_data_dir)
    return
Пример #4
0
def migrate_old_data(old_site_dir, old_data_dir, new_site_dir, new_data_dir):
    """
    Migrate data from a single old-site directory to the new site
    """
    old_dir = os.path.join(old_site_dir, old_data_dir)
    new_dir = os.path.join(new_site_dir, new_data_dir)
    if os.path.isdir(old_dir):
        print("- %s +> %s (migrating)" % (old_dir, new_dir))
        updatetree(old_dir, new_dir)
        archive_old_data(old_site_dir, old_data_dir)
    return
Пример #5
0
def migrate_old_data(old_site_dir, old_data_dir, new_site_dir, new_data_dir):
    """
    Migrate data from a single old-site directory to the new site
    """
    old_dir = os.path.join(old_site_dir, old_data_dir)
    old_dir_backup = os.path.join(old_site_dir, "backup_" + old_data_dir)
    new_dir = os.path.join(new_site_dir, new_data_dir)
    if os.path.isdir(old_dir):
        print("- %s +> %s (migrating)" % (old_dir, new_dir))
        updatetree(old_dir, new_dir)
        archive_old_data(old_site_dir, old_data_dir)
        # print("- %s >> %s (rename)"%(old_dir, old_dir_backup))
        # os.rename(old_dir, old_dir_backup)
    return
Пример #6
0
def migrate_old_data(old_site_dir, old_data_dir, new_site_dir, new_data_dir):
    """
    Migrate data from a single old-site directory to the new site
    """
    old_dir        = os.path.join(old_site_dir, old_data_dir)
    old_dir_backup = os.path.join(old_site_dir, "backup_"+old_data_dir)
    new_dir        = os.path.join(new_site_dir, new_data_dir)
    if os.path.isdir(old_dir):
        print("- %s +> %s (migrating)"%(old_dir, new_dir))
        updatetree(old_dir, new_dir)
        archive_old_data(old_site_dir, old_data_dir)
        # print("- %s >> %s (rename)"%(old_dir, old_dir_backup))
        # os.rename(old_dir, old_dir_backup)
    return
Пример #7
0
def am_updatesite(annroot, userhome, options):
    """
    Update site data, leaving user data alone

    annroot     is the root directory for the Annalist software installation.
    userhome    is the home directory for the host system user issuing the command.
    options     contains options parsed from the command line.

    returns     0 if all is well, or a non-zero status code.
                This value is intended to be used as an exit status code
                for the calling program.
    """
    settings = am_get_settings(annroot, userhome, options)
    if not settings:
        print("Settings not found (%s)" % (options.configuration),
              file=sys.stderr)
        return am_errors.AM_NOSETTINGS
    if len(options.args) > 0:
        print("Unexpected arguments for %s: (%s)" %
              (options.command, " ".join(options.args)),
              file=sys.stderr)
        return am_errors.AM_UNEXPECTEDARGS
    status = am_errors.AM_SUCCESS
    with SuppressLogging(logging.INFO):
        sitesettings = importlib.import_module(settings.modulename)
    sitebasedir = os.path.join(sitesettings.BASE_DATA_DIR, "annalist_site")
    # Test if site exists
    if not os.path.exists(sitebasedir):
        print("Site %s not found" % (sitebasedir), file=sys.stderr)
        return am_errors.AM_NOTEXISTS
    # --- Copy built-in types and views data to target area
    site_layout = Layout(sitesettings.BASE_DATA_DIR)
    sitedatasrc = os.path.join(annroot, "annalist/sitedata")
    sitedatatgt = os.path.join(sitebasedir, site_layout.SITEDATA_DIR)
    print("Copy Annalist site data from %s to %s" % (sitedatasrc, sitedatatgt))
    for sdir in ("types", "lists", "views", "groups", "fields", "enums"):
        s = os.path.join(sitedatasrc, sdir)
        d = os.path.join(sitedatatgt, sdir)
        print("- %s => %s" % (sdir, d))
        replacetree(s, d)
    for sdir in ("users", ):
        s = os.path.join(sitedatasrc, sdir)
        d = os.path.join(sitedatatgt, sdir)
        print("- %s +> %s" % (sdir, d))
        updatetree(s, d)
    return status
Пример #8
0
def am_createsite(annroot, userhome, options):
    """
    Create Annalist empty site data.

    annroot     is the root directory for the Annalist software installation.
    userhome    is the home directory for the host system user issuing the command.
    options     contains options parsed from the command line.

    returns     0 if all is well, or a non-zero status code.
                This value is intended to be used as an exit status code
                for the calling program.
    """
    status       = am_errors.AM_SUCCESS
    sitesettings = am_get_site_settings(annroot, userhome, options) 
    if not sitesettings:
        print("Settings not found (%s)"%(options.configuration), file=sys.stderr)
        return am_errors.AM_NOSETTINGS
    if len(options.args) > 0:
        print(
            "Unexpected arguments for %s: (%s)"%
            (options.command, " ".join(options.args)), 
            file=sys.stderr
            )
        return am_errors.AM_UNEXPECTEDARGS
    site_layout = layout.Layout(sitesettings.BASE_DATA_DIR, sitesettings.SITE_DIR_NAME)
    sitebasedir = site_layout.SITE_PATH
    #@@@@@ sitebaseurl = "/annalist/"     # @@TODO: figure more robust way to define this
    sitebaseurl = sitesettings.STATIC_URL
    # --- If old site exists and --force option given, remove it
    if os.path.exists(os.path.join(sitebasedir, site_layout.SITEDATA_DIR)):
        if options.force:
            print("Removing old Annalist site at %s"%(sitebasedir))
            log.info("rmtree: %s"%(sitebasedir))
            removetree(sitebasedir)
        else:
            print(
                "Old data already exists at %s (use '--force' or '-f' to overwrite)."%
                (sitebasedir), file=sys.stderr
                )
            print(
                "NOTE: using '--force' or '-f' "+
                "removes old site user permissions and namespace data "+
                "and requires re-initialization of Django database with local usernames; "+
                "consider using 'annalist-manager updatesite'."
                )
            return am_errors.AM_EXISTS
    # --- Initialize empty site data in target directory
    print("Initializing Annalist site in %s"%(sitebasedir))
    site = Site.create_site_metadata(
        sitebaseurl, sitebasedir,
        label="Annalist site (%s configuration)"%options.configuration, 
        description="Annalist %s site metadata and site-wide values."%options.configuration
        )
    sitedata = site.site_data_collection()
    Site.create_site_readme(site)
    site_data_src = os.path.join(annroot, "annalist/data/sitedata")     # @@TODO: more robust definition
    site_data_tgt, site_data_file = sitedata._dir_path()
    print("Copy Annalist site data")
    print("from %s"%site_data_src)
    for sdir in layout.COLL_DIRS:
        print("- %s -> %s"%(sdir, site_data_tgt))
        Site.replace_site_data_dir(sitedata, sdir, site_data_src)
    # @@TODO: filename logic copied from EntityRoot and Collection - create separate method for getting this
    (sitedata_dir, sitedata_file) = sitedata._dir_path()
    context_dir  = os.path.join(sitedata_dir, layout.META_COLL_BASE_REF)
    context_file = os.path.join(context_dir, layout.COLL_CONTEXT_FILE)
    #@@
    print("Generating %s"%(context_file))
    sitedata.generate_coll_jsonld_context()
    # --- Copy provider data to site config provider directory
    provider_dir_src = os.path.join(annroot, "annalist/data/identity_providers")
    provider_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "providers")
    print("Copy identity provider data:")
    print("- from: %s"%(provider_dir_src,))
    print("-   to: %s"%(provider_dir_tgt,))
    ensure_dir(provider_dir_tgt)
    updatetree(provider_dir_src, provider_dir_tgt)
    # --- Copy sample system configuration files to config directory
    config_dir_src = os.path.join(annroot, "annalist/data/config_examples")
    config_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "config")
    print("Copy system configuration sample files:")
    print("- from: %s"%(config_dir_src,))
    print("-   to: %s"%(config_dir_tgt,))
    ensure_dir(config_dir_tgt)
    updatetree(config_dir_src, config_dir_tgt)
    # --- Created
    print("Now run 'annalist-manager initialize' to create site admin database")
    return status
Пример #9
0
def am_updatesite(annroot, userhome, options):
    """
    Update site data, leaving user data alone

    annroot     is the root directory for the Annalist software installation.
    userhome    is the home directory for the host system user issuing the command.
    options     contains options parsed from the command line.

    returns     0 if all is well, or a non-zero status code.
                This value is intended to be used as an exit status code
                for the calling program.
    """
    status       = am_errors.AM_SUCCESS
    sitesettings = am_get_site_settings(annroot, userhome, options) 
    if not sitesettings:
        print("Settings not found (%s)"%(options.configuration), file=sys.stderr)
        return am_errors.AM_NOSETTINGS
    if len(options.args) > 0:
        print(
            "Unexpected arguments for %s: (%s)"%
            (options.command, " ".join(options.args)), 
            file=sys.stderr
            )
        return am_errors.AM_UNEXPECTEDARGS
    site_layout   = layout.Layout(sitesettings.BASE_DATA_DIR, sitesettings.SITE_DIR_NAME)
    sitebasedir   = site_layout.SITE_PATH
    sitebaseurl   = "/annalist/"                # @@TODO: figure more robust way to define this
    site          = Site(sitebaseurl, site_layout.SITE_PATH)
    sitedata      = site.site_data_collection(test_exists=False)
    if sitedata is None:
        print("Initializing Annalist site metadata in %s (migrating to new layout)"%(sitebasedir))
        site = Site.create_site_metadata(
            sitebaseurl, sitebasedir,
            label="Annalist site (%s configuration)"%options.configuration, 
            description="Annalist %s site metadata and site-wide values."%options.configuration
            )
        sitedata      = site.site_data_collection()
    site_data_src = os.path.join(annroot, "annalist/data/sitedata")  # @@TODO: more robust definition
    site_data_tgt, site_data_file = sitedata._dir_path()
    # --- Migrate old site data to new site directory
    #    _annalist_site/
    site_data_old1      = os.path.join(sitebasedir, site_layout.SITEDATA_OLD_DIR1)
    old_site_metadata   = os.path.join(site_data_old1, site_layout.SITE_META_FILE)
    old_site_database   = os.path.join(site_data_old1, site_layout.SITE_DATABASE_FILE)
    old_users1          = os.path.join(site_data_old1, layout.USER_DIR_PREV)
    old_vocabs1         = os.path.join(site_data_old1, layout.VOCAB_DIR_PREV)
    if os.path.isfile(old_site_metadata):
        print("Move old site metadata: %s -> %s"%(old_site_metadata, sitebasedir))
        new_site_metadata   = os.path.join(sitebasedir, site_layout.SITE_META_FILE)
        os.rename(old_site_metadata, new_site_metadata)
    if os.path.isfile(old_site_database):
        print("Move old site database: %s -> %s"%(old_site_database, sitebasedir))
        new_site_database   = os.path.join(sitebasedir, site_layout.SITE_DATABASE_FILE)
        os.rename(old_site_database, new_site_database)
    if os.path.isdir(old_users1) or os.path.isdir(old_vocabs1):
        print("Copy Annalist old user and/or vocab data from %s"%site_data_old1)
        migrate_old_data(site_data_old1, layout.USER_DIR_PREV,  site_data_tgt, layout.USER_DIR )
        migrate_old_data(site_data_old1, layout.VOCAB_DIR_PREV, site_data_tgt, layout.VOCAB_DIR)
    #    c/_annalist_site/_annalist_collection/ - using new dir names
    site_data_old2 = os.path.join(sitebasedir, site_layout.SITEDATA_OLD_DIR2)
    old_users2     = os.path.join(site_data_old2, layout.USER_DIR)
    old_vocabs2    = os.path.join(site_data_old2, layout.VOCAB_DIR)
    if os.path.isdir(old_users2) or os.path.isdir(old_vocabs2):
        print("Copy Annalist old user and/or vocab data from %s"%site_data_old2)
        migrate_old_data(site_data_old2, layout.USER_DIR_PREV,  site_data_tgt, layout.USER_DIR )
        migrate_old_data(site_data_old2, layout.VOCAB_DIR_PREV, site_data_tgt, layout.VOCAB_DIR)
    # --- Archive old site data so it's not visible next time
    if os.path.isdir(site_data_old1):  
        archive_old_data(site_data_old1, "")
    if os.path.isdir(site_data_old2):
        archive_old_data(site_data_old2, "")
    # --- Copy latest site data to target directory
    print("Copy Annalist site data")
    print("from %s"%site_data_src)
    for sdir in layout.DATA_DIRS:
        print("- %s -> %s"%(sdir, site_data_tgt))
        Site.replace_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in (layout.USER_DIR, layout.VOCAB_DIR):
        print("- %s +> %s"%(sdir, site_data_tgt))
        Site.update_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in (layout.INFO_DIR,):
        print("- %s ~> %s"%(sdir, site_data_tgt))
        Site.expand_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in layout.COLL_DIRS_PREV:
        remove_old_data(site_data_tgt, sdir)
    print("Generating context for site data")
    sitedata.generate_coll_jsonld_context()
    # --- Copy provider data to site config provider directory
    provider_dir_src = os.path.join(annroot, "annalist/data/identity_providers")
    provider_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "providers")
    print("Copy identity provider data:")
    print("- from: %s"%(provider_dir_src,))
    print("-   to: %s"%(provider_dir_tgt,))
    ensure_dir(provider_dir_tgt)
    updatetree(provider_dir_src, provider_dir_tgt)
    # --- Copy sample system configuration files to config directory
    config_dir_src = os.path.join(annroot, "annalist/data/config_examples")
    config_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "config")
    print("Copy system configuration sample files:")
    print("- from: %s"%(config_dir_src,))
    print("-   to: %s"%(config_dir_tgt,))
    ensure_dir(config_dir_tgt)
    updatetree(config_dir_src, provider_dir_tgt)
    return status
Пример #10
0
def am_updatesite(annroot, userhome, options):
    """
    Update site data, leaving user data alone

    annroot     is the root directory for the Annalist software installation.
    userhome    is the home directory for the host system user issuing the command.
    options     contains options parsed from the command line.

    returns     0 if all is well, or a non-zero status code.
                This value is intended to be used as an exit status code
                for the calling program.
    """
    status = am_errors.AM_SUCCESS
    sitesettings = am_get_site_settings(annroot, userhome, options)
    if not sitesettings:
        print("Settings not found (%s)" % (options.configuration),
              file=sys.stderr)
        return am_errors.AM_NOSETTINGS
    if len(options.args) > 0:
        print("Unexpected arguments for %s: (%s)" %
              (options.command, " ".join(options.args)),
              file=sys.stderr)
        return am_errors.AM_UNEXPECTEDARGS
    site_layout = layout.Layout(sitesettings.BASE_DATA_DIR)
    sitebasedir = site_layout.SITE_PATH
    sitebaseurl = "/annalist/"  # @@TODO: figure more robust way to define this
    site = Site(sitebaseurl, site_layout.SITE_PATH)
    sitedata = site.site_data_collection(test_exists=False)
    if sitedata is None:
        print(
            "Initializing Annalist site metadata in %s (migrating to new layout)"
            % (sitebasedir))
        site = Site.create_empty_site_data(
            sitebaseurl,
            sitebasedir,
            label="Annalist site (%s configuration)" % options.configuration,
            description="Annalist %s site metadata and site-wide values." %
            options.configuration)
        sitedata = site.site_data_collection()
    site_data_src = os.path.join(
        annroot, "annalist/data/sitedata")  # @@TODO: more robust definition
    site_data_tgt, site_data_file = sitedata._dir_path()
    # --- Migrate old site data to new site directory
    site_data_old = os.path.join(sitebasedir, site_layout.SITEDATA_OLD_DIR)
    old_users = os.path.join(site_data_old, layout.USER_DIR_PREV)
    old_vocabs = os.path.join(site_data_old, layout.VOCAB_DIR_PREV)
    if os.path.isdir(old_users) or os.path.isdir(old_vocabs):
        print("Copy Annalist old user and/or vocab data from %s" %
              site_data_old)
        migrate_old_data(site_data_old, layout.USER_DIR_PREV, site_data_tgt,
                         layout.USER_DIR)
        migrate_old_data(site_data_old, layout.VOCAB_DIR_PREV, site_data_tgt,
                         layout.VOCAB_DIR)
    #@@
    # if os.path.isdir(old_users) or os.path.isdir(old_vocabs):
    #     print("Copy Annalist old user and/or vocab data from %s"%site_data_old)
    #     for sdir in ("users", "vocabs"):
    #         s     = os.path.join(site_data_old, sdir)
    #         old_s = os.path.join(site_data_old, "old_"+sdir)
    #         d     = os.path.join(site_data_tgt, sdir)
    #         if os.path.isdir(s):
    #             print("- %s +> %s (migrating)"%(sdir, d))
    #             updatetree(s, d)
    #             print("- %s >> %s (rename)"%(sdir, old_s))
    #             os.rename(s, old_s)
    #@@
    # --- Copy latest site data to target directory
    print("Copy Annalist site data")
    print("from %s" % site_data_src)
    for sdir in layout.DATA_DIRS:
        print("- %s -> %s" % (sdir, site_data_tgt))
        Site.replace_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in (layout.USER_DIR, layout.VOCAB_DIR):
        print("- %s +> %s" % (sdir, site_data_tgt))
        Site.update_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in layout.COLL_DIRS_PREV:
        remove_old_data(site_data_tgt, sdir)
    print("Generating %s" % (site_layout.SITEDATA_CONTEXT_DIR))
    sitedata.generate_coll_jsonld_context()
    # --- Copy provider data to site config provider directory
    provider_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "providers")
    provider_dir_src = os.path.join(annroot,
                                    "annalist/data/identity_providers")
    print("Copy identity provider data:")
    print("- from: %s" % (provider_dir_src, ))
    print("-   to: %s" % (provider_dir_tgt, ))
    updatetree(provider_dir_src, provider_dir_tgt)
    return status
Пример #11
0
def am_createsite(annroot, userhome, options):
    """
    Create Annalist empty site data.

    annroot     is the root directory for the Annalist software installation.
    userhome    is the home directory for the host system user issuing the command.
    options     contains options parsed from the command line.

    returns     0 if all is well, or a non-zero status code.
                This value is intended to be used as an exit status code
                for the calling program.
    """
    status = am_errors.AM_SUCCESS
    sitesettings = am_get_site_settings(annroot, userhome, options)
    if not sitesettings:
        print("Settings not found (%s)" % (options.configuration),
              file=sys.stderr)
        return am_errors.AM_NOSETTINGS
    if len(options.args) > 0:
        print("Unexpected arguments for %s: (%s)" %
              (options.command, " ".join(options.args)),
              file=sys.stderr)
        return am_errors.AM_UNEXPECTEDARGS
    site_layout = layout.Layout(sitesettings.BASE_DATA_DIR)
    sitebasedir = site_layout.SITE_PATH
    sitebaseurl = "/annalist/"  # @@TODO: figure more robust way to define this
    # --- If old site exists and --force option given, remove it
    if os.path.exists(os.path.join(sitebasedir, site_layout.SITEDATA_DIR)):
        if options.force:
            print("Removing old Annalist site at %s" % (sitebasedir))
            log.info("rmtree: %s" % (sitebasedir))
            removetree(sitebasedir)
        else:
            print(
                "Old data already exists at %s (use '--force' or '-f' to overwrite)."
                % (sitebasedir),
                file=sys.stderr)
            print(
                "NOTE: using '--force' or '-f' " +
                "removes old site user permissions and namespace data " +
                "and requires re-initialization of Django database with local usernames; "
                + "consider using 'annalist-manager updatesite'.")
            return am_errors.AM_EXISTS
    # --- Initialize empty site data in target directory
    print("Initializing Annalist site in %s" % (sitebasedir))
    site = Site.create_site_metadata(
        sitebaseurl,
        sitebasedir,
        label="Annalist site (%s configuration)" % options.configuration,
        description="Annalist %s site metadata and site-wide values." %
        options.configuration)
    sitedata = site.site_data_collection()
    Site.create_site_readme(site)
    site_data_src = os.path.join(
        annroot, "annalist/data/sitedata")  # @@TODO: more robust definition
    site_data_tgt, site_data_file = sitedata._dir_path()
    print("Copy Annalist site data")
    print("from %s" % site_data_src)
    for sdir in layout.COLL_DIRS:
        print("- %s -> %s" % (sdir, site_data_tgt))
        Site.replace_site_data_dir(sitedata, sdir, site_data_src)
    # @@TODO: filename logic copied from EntityRoot and Collection - create separate method for getting this
    (sitedata_dir, sitedata_file) = sitedata._dir_path()
    context_dir = os.path.join(sitedata_dir, layout.META_COLL_BASE_REF)
    context_file = os.path.join(context_dir, layout.COLL_CONTEXT_FILE)
    #@@
    print("Generating %s" % (context_file))
    sitedata.generate_coll_jsonld_context()
    # --- Copy provider data to site config provider directory
    provider_dir_src = os.path.join(annroot,
                                    "annalist/data/identity_providers")
    provider_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "providers")
    print("Copy identity provider data:")
    print("- from: %s" % (provider_dir_src, ))
    print("-   to: %s" % (provider_dir_tgt, ))
    ensure_dir(provider_dir_tgt)
    updatetree(provider_dir_src, provider_dir_tgt)
    # --- Created
    print(
        "Now run 'annalist-manager initialize' to create site admin database")
    return status
Пример #12
0
def am_updatesite(annroot, userhome, options):
    """
    Update site data, leaving user data alone

    annroot     is the root directory for the Annalist software installation.
    userhome    is the home directory for the host system user issuing the command.
    options     contains options parsed from the command line.

    returns     0 if all is well, or a non-zero status code.
                This value is intended to be used as an exit status code
                for the calling program.
    """
    status       = am_errors.AM_SUCCESS
    sitesettings = am_get_site_settings(annroot, userhome, options) 
    if not sitesettings:
        print("Settings not found (%s)"%(options.configuration), file=sys.stderr)
        return am_errors.AM_NOSETTINGS
    if len(options.args) > 0:
        print(
            "Unexpected arguments for %s: (%s)"%
            (options.command, " ".join(options.args)), 
            file=sys.stderr
            )
        return am_errors.AM_UNEXPECTEDARGS
    site_layout   = layout.Layout(sitesettings.BASE_DATA_DIR)
    sitebasedir   = site_layout.SITE_PATH
    sitebaseurl   = "/annalist/"                # @@TODO: figure more robust way to define this
    site          = Site(sitebaseurl, site_layout.SITE_PATH)
    sitedata      = site.site_data_collection(test_exists=False)
    if sitedata is None:
        print("Initializing Annalist site metadata in %s (migrating to new layout)"%(sitebasedir))
        site = Site.create_empty_site_data(
            sitebaseurl, sitebasedir,
            label="Annalist site (%s configuration)"%options.configuration, 
            description="Annalist %s site metadata and site-wide values."%options.configuration
            )
        sitedata      = site.site_data_collection()
    site_data_src = os.path.join(annroot, "annalist/data/sitedata")  # @@TODO: more robust definition
    site_data_tgt, site_data_file = sitedata._dir_path()
    # --- Migrate old site data to new site directory
    site_data_old = os.path.join(sitebasedir, site_layout.SITEDATA_OLD_DIR)
    old_users     = os.path.join(site_data_old, layout.USER_DIR_PREV)
    old_vocabs    = os.path.join(site_data_old, layout.VOCAB_DIR_PREV)
    if os.path.isdir(old_users) or os.path.isdir(old_vocabs):
        print("Copy Annalist old user and/or vocab data from %s"%site_data_old)
        migrate_old_data(site_data_old, layout.USER_DIR_PREV,  site_data_tgt, layout.USER_DIR )
        migrate_old_data(site_data_old, layout.VOCAB_DIR_PREV, site_data_tgt, layout.VOCAB_DIR)
    #@@
    # if os.path.isdir(old_users) or os.path.isdir(old_vocabs):
    #     print("Copy Annalist old user and/or vocab data from %s"%site_data_old)
    #     for sdir in ("users", "vocabs"):
    #         s     = os.path.join(site_data_old, sdir)
    #         old_s = os.path.join(site_data_old, "old_"+sdir)
    #         d     = os.path.join(site_data_tgt, sdir)
    #         if os.path.isdir(s):
    #             print("- %s +> %s (migrating)"%(sdir, d))
    #             updatetree(s, d)
    #             print("- %s >> %s (rename)"%(sdir, old_s))
    #             os.rename(s, old_s)
    #@@
    # --- Copy latest site data to target directory
    print("Copy Annalist site data")
    print("from %s"%site_data_src)
    for sdir in layout.DATA_DIRS:
        print("- %s -> %s"%(sdir, site_data_tgt))
        Site.replace_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in (layout.USER_DIR, layout.VOCAB_DIR):
        print("- %s +> %s"%(sdir, site_data_tgt))
        Site.update_site_data_dir(sitedata, sdir, site_data_src)
    for sdir in layout.COLL_DIRS_PREV:
        remove_old_data(site_data_tgt, sdir)
    print("Generating %s"%(site_layout.SITEDATA_CONTEXT_DIR))
    sitedata.generate_coll_jsonld_context()
    # --- Copy provider data to site config provider directory
    provider_dir_tgt = os.path.join(sitesettings.CONFIG_BASE, "providers")
    provider_dir_src = os.path.join(annroot, "annalist/data/identity_providers")
    print("Copy identity provider data:")
    print("- from: %s"%(provider_dir_src,))
    print("-   to: %s"%(provider_dir_tgt,))
    updatetree(provider_dir_src, provider_dir_tgt)
    return status