Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(6)  |  Derive(0)  |  Import(6)
Given a list of files in an archive, validate that they are relative paths, not absolute. Also,
determine whether this is a common directory under which all files appear. If either test fails, raise
an exception. Otherwise, return the name of the common directory

        def validate_archive_files(namelist):
    """Given a list of files in an archive, validate that they are relative paths, not absolute. Also,
    determine whether this is a common directory under which all files appear. If either test fails, raise
    an exception. Otherwise, return the name of the common directory
    """
    common_dirname = None
    for name in namelist:
        if os.path.isabs(name):
            raise ArchiveStructureError("Invalid format for archive: contains absolute file path %s" % name)
        if name.find(os.sep): # contains a directory component
            subdir = _get_first_subdir_component(name)
        else:
            subdir = name
        if common_dirname == None:
            common_dirname = subdir
        elif common_dirname != subdir:
            raise ArchiveStructureError("File %s does not fall under common subdirectory %s" % (name, common_dirname))
    return common_dirname
        


src/d/a/datablox-HEAD/engage/engage-dist/python_pkg/engage/drivers/genforma/engage_django_sdk/packager/generate_settings.py   datablox(Download)
from utils import app_module_name_to_dir, create_virtualenv, \
                  install_requirements, write_platform_requirements_file
from archive_handlers import create_handler, validate_archive_files
from find_module import find_python_module
from errors import FileMissingError
    else: # we have an archive
        with create_handler(archive_file_or_directory) as h:
            common_dir = validate_archive_files(h.get_namelist())
            h.extract(install_path)
        app_dir_path = os.path.join(install_path, common_dir)

src/e/n/engage-HEAD/python_pkg/engage/drivers/genforma/engage_django_sdk/packager/generate_settings.py   engage(Download)
from utils import app_module_name_to_dir, create_virtualenv, \
                  install_requirements, write_platform_requirements_file
from archive_handlers import create_handler, validate_archive_files
from find_module import find_python_module
from errors import FileMissingError
    else: # we have an archive
        with create_handler(archive_file_or_directory) as h:
            common_dir = validate_archive_files(h.get_namelist())
            h.extract(install_path)
        app_dir_path = os.path.join(install_path, common_dir)

src/d/a/datablox-HEAD/engage/engage-dist/python_pkg/engage/drivers/genforma/engage_django_sdk/packager/__init__.py   datablox(Download)
 
from errors import *
from archive_handlers import ZipfileHandler, TarfileHandler, create_handler, \
                             validate_archive_files
from django_config import django_config_from_validation_results, django_config_from_json
    # check archive format
    namelist = handler.get_namelist()
    common_dir = validate_archive_files(namelist)
    logger.debug("Common directory is %s" % common_dir)
 

src/e/n/engage-HEAD/python_pkg/engage/drivers/genforma/engage_django_sdk/packager/__init__.py   engage(Download)
 
from errors import *
from archive_handlers import ZipfileHandler, TarfileHandler, create_handler, \
                             validate_archive_files
from django_config import django_config_from_validation_results, django_config_from_json
    # check archive format
    namelist = handler.get_namelist()
    common_dir = validate_archive_files(namelist)
    logger.debug("Common directory is %s" % common_dir)
 

src/e/n/engage-django-sdk-1.0.0/engage_django_sdk/packager/generate_settings.py   engage-django-sdk(Download)
from utils import app_module_name_to_dir, create_virtualenv, \
                  install_requirements, write_platform_requirements_file
from archive_handlers import create_handler, validate_archive_files
from find_module import find_python_module
from errors import FileMissingError
    else: # we have an archive
        with create_handler(archive_file_or_directory) as h:
            common_dir = validate_archive_files(h.get_namelist())
            h.extract(install_path)
        app_dir_path = os.path.join(install_path, common_dir)

src/e/n/engage-django-sdk-1.0.0/engage_django_sdk/packager/__init__.py   engage-django-sdk(Download)
 
from errors import *
from archive_handlers import ZipfileHandler, TarfileHandler, create_handler, \
                             validate_archive_files
from django_config import django_config_from_validation_results, django_config_from_json
    # check archive format
    namelist = handler.get_namelist()
    common_dir = validate_archive_files(namelist)
    logger.debug("Common directory is %s" % common_dir)