def create(source,
           requirement_files=None,
           force=False,
           keep_wheels=False,
           archive_destination_dir='.',
           python_versions=None,
           validate_archive=False,
           wheel_args='',
           archive_format='zip',
           build_tag=''):
    """Create a Wagon archive and returns its path.

    Package name and version are extracted from the setup.py file
    of the `source` or from the PACKAGE_NAME==PACKAGE_VERSION if the source
    is a PyPI package.

    Supported `python_versions` must be in the format e.g [33, 27, 2, 3]..

    `force` will remove any excess dirs or archives before creation.

    `requirement_files` can be either a link/local path to a
    requirements.txt file or just `.`, in which case requirement files
    will be automatically extracted from either the GitHub archive URL
    or the local path provided provided in `source`.
    """
    if validate_archive:
        _assert_virtualenv_is_installed()

    logger.info('Creating archive for %s...', source)
    processed_source = get_source(source)
    if os.path.isdir(processed_source) and not \
            os.path.isfile(os.path.join(processed_source, 'setup.py')):
        raise WagonError(
            'Source directory must contain a setup.py file')
    package_name, package_version = get_source_name_and_version(
        processed_source)

    tempdir = tempfile.mkdtemp()
    workdir = os.path.join(tempdir, package_name)
    wheels_path = os.path.join(workdir, DEFAULT_WHEELS_PATH)

    try:
        wheels = wheel(
            processed_source,
            requirement_files,
            wheels_path,
            wheel_args)
    finally:
        if processed_source != source:
            shutil.rmtree(processed_source, ignore_errors=True)

    platform = _get_platform_for_set_of_wheels(wheels_path)
    if is_verbose():
        logger.debug('Platform is: %s', platform)
    python_versions = _set_python_versions(python_versions)

    if not os.path.isdir(archive_destination_dir):
        os.makedirs(archive_destination_dir)
    archive_name = _set_archive_name(
        package_name, package_version, python_versions, platform, build_tag)
    archive_path = os.path.join(archive_destination_dir, archive_name)

    _handle_output_file(archive_path, force)
    _generate_metadata_file(
        workdir,
        archive_name,
        platform,
        python_versions,
        package_name,
        package_version,
        build_tag,
        source,
        wheels)

    _create_wagon_archive(workdir, archive_path, archive_format)
    if not keep_wheels:
        logger.debug('Removing work directory...')
        shutil.rmtree(tempdir, ignore_errors=True)

    if validate_archive:
        validate(archive_path)
    logger.info('Wagon created successfully at: %s', archive_path)
    return archive_path
def create ( source , requirement_files = None , force = False , keep_wheels = False , archive_destination_dir = '.' , python_versions = None , validate_archive = False , wheel_args = '' , archive_format = 'zip' , build_tag = '' ) : if validate_archive : _assert_virtualenv_is_installed ( ) logger . info ( 'Creating archive for %s...' , source ) processed_source = get_source ( source ) if os . path . isdir ( processed_source ) and not os . path . isfile ( os . path . join ( processed_source , 'setup.py' ) ) : raise WagonError ( 'Source directory must contain a setup.py file' ) package_name , package_version = get_source_name_and_version ( processed_source ) tempdir = tempfile . mkdtemp ( ) workdir = os . path . join ( tempdir , package_name ) wheels_path = os . path . join ( workdir , DEFAULT_WHEELS_PATH ) try : wheels = wheel ( processed_source , requirement_files , wheels_path , wheel_args ) finally : if processed_source != source : shutil . rmtree ( processed_source , ignore_errors = True ) platform = _get_platform_for_set_of_wheels ( wheels_path ) if is_verbose ( ) : logger . debug ( 'Platform is: %s' , platform ) python_versions = _set_python_versions ( python_versions ) if not os . path . isdir ( archive_destination_dir ) : os . makedirs ( archive_destination_dir ) archive_name = _set_archive_name ( package_name , package_version , python_versions , platform , build_tag ) archive_path = os . path . join ( archive_destination_dir , archive_name ) _handle_output_file ( archive_path , force ) _generate_metadata_file ( workdir , archive_name , platform , python_versions , package_name , package_version , build_tag , source , wheels ) _create_wagon_archive ( workdir , archive_path , archive_format ) if not keep_wheels : logger . debug ( 'Removing work directory...' ) shutil . rmtree ( tempdir , ignore_errors = True ) if validate_archive : validate ( archive_path ) logger . info ( 'Wagon created successfully at: %s' , archive_path ) return archive_path
Create a Wagon archive and returns its path.

    Package name and version are extracted from the setup.py file
    of the `source` or from the PACKAGE_NAME==PACKAGE_VERSION if the source
    is a PyPI package.

    Supported `python_versions` must be in the format e.g [33, 27, 2, 3]..

    `force` will remove any excess dirs or archives before creation.

    `requirement_files` can be either a link/local path to a
    requirements.txt file or just `.`, in which case requirement files
    will be automatically extracted from either the GitHub archive URL
    or the local path provided provided in `source`.