예제 #1
0
def parse_args(args):
    p = get_render_parser()
    p.description = """

Set up environments and activation scripts to debug your build or test phase.

"""
    # we do this one separately because we only allow one entry to conda render
    p.add_argument(
        'recipe_or_package_file_path',
        help=("Path to recipe directory or package file to use for dependency and source information. "
              "If you use a recipe, you get the build/host env and source work directory.  If you use "
              "a package file, you get the test environments and the test_tmp folder."),
    )
    p.add_argument("-p", "--path",
                   help=("root path in which to place envs, source and activation script.  Defaults to a "
                         "standard conda-build work folder (packagename_timestamp) in your conda-bld folder."))
    p.add_argument("-o", "--output-id",
                   help=("fnmatch pattern that is associated with the output that you want to create an env for.  "
                         "Must match only one file, as we don't support creating envs for more than one output at a time. "
                         "The top-level recipe can be specified by passing 'TOPLEVEL' here"))
    p.add_argument("-a", "--activate-string-only", action="store_true",
                   help="Output only the string to the used generated activation script.  Use this for creating envs in scripted "
                   "environments.")

    # cut out some args from render that don't make sense here
    #    https://stackoverflow.com/a/32809642/1170370
    p._handle_conflict_resolve(None, [('--output', [_ for _ in p._actions if _.option_strings == ['--output']][0])])
    p._handle_conflict_resolve(None, [('--bootstrap', [_ for _ in p._actions if _.option_strings == ['--bootstrap']][0])])
    p._handle_conflict_resolve(None, [('--old-build-string', [_ for _ in p._actions if
                                                              _.option_strings == ['--old-build-string']][0])])
    args = p.parse_args(args)
    return p, args
예제 #2
0
def parse_args(args):
    p = get_render_parser()
    p.description = """

Set up environments and activation scripts to debug your build or test phase.

"""
    # we do this one separately because we only allow one entry to conda render
    p.add_argument(
        'recipe_or_package_file_path',
        help=("Path to recipe directory or package file to use for dependency and source information. "
              "If you use a recipe, you get the build/host env and source work directory.  If you use "
              "a package file, you get the test environments and the test_tmp folder."),
    )
    p.add_argument("-p", "--path",
                   help=("root path in which to place envs, source and activation script.  Defaults to a "
                         "standard conda-build work folder (packagename_timestamp) in your conda-bld folder."))
    p.add_argument("-o", "--output-id",
                   help=("fnmatch pattern that is associated with the output that you want to create an env for.  "
                         "Must match only one file, as we don't support creating envs for more than one output at a time. "
                         "The top-level recipe can be specified by passing 'TOPLEVEL' here"))
    p.add_argument("-a", "--activate-string-only", action="store_true",
                   help="Output only the string to the used generated activation script.  Use this for creating envs in scripted "
                   "environments.")

    # cut out some args from render that don't make sense here
    #    https://stackoverflow.com/a/32809642/1170370
    p._handle_conflict_resolve(None, [('--output', [_ for _ in p._actions if _.option_strings == ['--output']][0])])
    p._handle_conflict_resolve(None, [('--bootstrap', [_ for _ in p._actions if _.option_strings == ['--bootstrap']][0])])
    p._handle_conflict_resolve(None, [('--old-build-string', [_ for _ in p._actions if
                                                              _.option_strings == ['--old-build-string']][0])])
    args = p.parse_args(args)
    return p, args
예제 #3
0
def parse_args(args):
    p = get_render_parser()
    p.description = """
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages."""
    p.add_argument(
        "--check",
        action="store_true",
        help="Only check (validate) the recipe.",
    )
    p.add_argument(
        "--no-anaconda-upload",
        action="store_false",
        help="Do not ask to upload the package to anaconda.org.",
        dest='anaconda_upload',
        default=binstar_upload,
    )
    p.add_argument(
        "--no-binstar-upload",
        action="store_false",
        help=argparse.SUPPRESS,
        dest='anaconda_upload',
        default=binstar_upload,
    )
    p.add_argument(
        "--no-include-recipe",
        action="store_false",
        help="Don't include the recipe inside the built package.",
        dest='include_recipe',
        default=cc_conda_build.get('include_recipe', 'true').lower() == 'true',
    )
    p.add_argument(
        '-s',
        "--source",
        action="store_true",
        help="Only obtain the source (but don't build).",
    )
    p.add_argument(
        '-t',
        "--test",
        action="store_true",
        help=
        "Test package (assumes package is already built).  RECIPE_DIR argument can be either "
        "recipe directory, in which case source download may be necessary to resolve package "
        "version, or path to built package .tar.bz2 file, in which case no source is necessary.",
    )
    p.add_argument(
        '--no-test',
        action='store_true',
        dest='notest',
        help="Do not test the package.",
    )
    p.add_argument(
        '-b',
        '--build-only',
        action="store_true",
        help="""Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.""",
    )
    p.add_argument(
        '-p',
        '--post',
        action="store_true",
        help=
        "Run the post-build logic. Implies --no-test and --no-anaconda-upload.",
    )
    p.add_argument(
        'recipe',
        metavar='RECIPE_PATH',
        nargs='+',
        help="Path to recipe directory.  Pass 'purge' here to clean the "
        "work and test intermediates.",
    )
    p.add_argument(
        '--skip-existing',
        action='store_true',
        help=("Skip recipes for which there already exists an existing build "
              "(locally or in the channels)."),
        default=cc_conda_build.get('skip_existing', 'false').lower() == 'true',
    )
    p.add_argument(
        '--keep-old-work',
        action='store_true',
        dest='keep_old_work',
        help="Do not remove anything from environment, even after successful "
        "build and test.")
    p.add_argument(
        '--dirty',
        action='store_true',
        help='Do not remove work directory or _build environment, '
        'to speed up debugging.  Does not apply patches or download source.')
    p.add_argument(
        '-q',
        "--quiet",
        action="store_true",
        help="do not display progress bar",
        default=cc_conda_build.get('quiet', 'false').lower() == 'true',
    )
    p.add_argument(
        '--debug',
        action="store_true",
        help="Show debug output from source checkouts and conda",
    )
    p.add_argument(
        '--token',
        help="Token to pass through to anaconda upload",
        default=cc_conda_build.get('anaconda_token'),
    )
    p.add_argument(
        '--user',
        help="User/organization to upload packages to on anaconda.org or pypi",
        default=cc_conda_build.get('user'),
    )
    p.add_argument(
        '--label',
        action='append',
        dest='labels',
        default=[],
        help="Label argument to pass through to anaconda upload",
    )
    p.add_argument(
        '--no-force-upload',
        help=
        "Disable force upload to anaconda.org, preventing overwriting any existing packages",
        dest='force_upload',
        default=True,
        action='store_false',
    )
    pypi_grp = p.add_argument_group("PyPI upload parameters (twine)")
    pypi_grp.add_argument(
        '--password',
        help="password to use when uploading packages to pypi",
    )
    pypi_grp.add_argument('--sign',
                          default=False,
                          help="sign files when uploading to pypi")
    pypi_grp.add_argument(
        '--sign-with',
        default='gpg',
        dest='sign_with',
        help="program to use to sign files when uploading to pypi")
    pypi_grp.add_argument(
        '--identity',
        help="GPG identity to use to sign files when uploading to pypi")
    pypi_grp.add_argument(
        '--config-file',
        help="path to .pypirc file to use when uploading to pypi",
        default=(abspath(expanduser(expandvars(cc_conda_build.get('pypirc'))))
                 if cc_conda_build.get('pypirc') else
                 cc_conda_build.get('pypirc')),
    )
    pypi_grp.add_argument(
        '--repository',
        '-r',
        help="PyPI repository to upload to",
        default=cc_conda_build.get('pypi_repository', 'pypitest'),
    )
    p.add_argument(
        "--no-activate",
        action="store_false",
        help="do not activate the build and test envs; just prepend to PATH",
        dest='activate',
        default=cc_conda_build.get('activate', 'true').lower() == 'true',
    )
    p.add_argument(
        "--no-build-id",
        action="store_false",
        help=
        ("do not generate unique build folder names.  Use if having issues with "
         "paths being too long."),
        dest='set_build_id',
        # note: inverted - dest stores positive logic
        default=cc_conda_build.get('set_build_id', 'true').lower() == 'true',
    )
    p.add_argument(
        "--croot",
        help=
        ("Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only "
         "to this call of conda-build."))
    p.add_argument(
        "--verify",
        action="store_true",
        help="run verification on recipes or packages when building",
        default=cc_conda_build.get('verify', 'true').lower() == 'true',
    )
    p.add_argument(
        "--no-verify",
        action="store_false",
        dest="verify",
        help="do not run verification on recipes or packages when building",
        default=cc_conda_build.get('verify', 'true').lower() == 'true',
    )
    p.add_argument(
        "--strict-verify",
        action="store_true",
        dest="exit_on_verify_error",
        help=
        "Exit if any conda-verify check fail, instead of only printing them",
        default=cc_conda_build.get('exit_on_verify_error',
                                   'false').lower() == 'true',
    )
    p.add_argument(
        "--output-folder",
        help=
        ("folder to dump output package to.  Package are moved here if build or test succeeds."
         "  Destination folder must exist prior to using this."),
        default=cc_conda_build.get('output_folder'))
    p.add_argument(
        "--no-prefix-length-fallback",
        dest='prefix_length_fallback',
        action="store_false",
        help=
        ("Disable fallback to older 80 character prefix length if environment creation"
         " fails due to insufficient prefix length in dependency packages"),
        default=True,
    )
    p.add_argument(
        "--prefix-length-fallback",
        dest='prefix_length_fallback',
        action="store_true",
        help=
        ("Disable fallback to older 80 character prefix length if environment creation"
         " fails due to insufficient prefix length in dependency packages"),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=True,
    )
    p.add_argument(
        "--prefix-length",
        dest='_prefix_length',
        help=
        ("length of build prefix.  For packages with binaries that embed the path, this is"
         " critical to ensuring that your package can run as many places as possible.  Note"
         "that this value can be altered by the OS below conda-build (e.g. encrypted "
         "filesystems on Linux), and you should prefer to set --croot to a non-encrypted "
         "location instead, so that you maintain a known prefix length."),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=255,
        type=int,
    )
    p.add_argument(
        "--no-locking",
        dest='locking',
        default=True,
        action="store_false",
        help=
        ("Disable locking, to avoid unresolved race condition issues.  Unsafe to run multiple "
         "builds at once on one system with this set."))
    p.add_argument(
        "--no-remove-work-dir",
        dest='remove_work_dir',
        default=True,
        action="store_false",
        help=
        ("Disable removal of the work dir before testing.  Be careful using this option, as"
         " you package may depend on files that are not included in the package, and may pass "
         "tests, but ultimately fail on installed systems."))
    p.add_argument(
        "--error-overlinking",
        dest='error_overlinking',
        action="store_true",
        help=
        ("Enable error when shared libraries from transitive dependencies are directly "
         "linked to any executables or shared libraries in built packages.  This is disabled "
         "by default, but will be enabled by default in conda-build 4.0."),
        default=cc_conda_build.get('error_overlinking',
                                   'false').lower() == 'true',
    )
    p.add_argument(
        "--no-error-overlinking",
        dest='error_overlinking',
        action="store_false",
        help=
        ("Disable error when shared libraries from transitive dependencies are directly "
         "linked to any executables or shared libraries in built packages.  This is currently "
         "the default behavior, but will change in conda-build 4.0."),
        default=cc_conda_build.get('error_overlinking',
                                   'false').lower() == 'true',
    )
    p.add_argument(
        "--error-overdepending",
        dest='error_overdepending',
        action="store_true",
        help=
        ("Enable error when packages with names beginning `lib` or which have "
         "`run_exports` are not auto-loaded by the OSes DSO loading mechanism by "
         "any of the files in this package."),
        default=cc_conda_build.get('error_overdepending',
                                   'false').lower() == 'true',
    )
    p.add_argument(
        "--no-error-overdepending",
        dest='error_overdepending',
        action="store_false",
        help=
        ("Disable error when packages with names beginning `lib` or which have "
         "`run_exports` are not auto-loaded by the OSes DSO loading mechanism by "
         "any of the files in this package."),
        default=cc_conda_build.get('error_overdepending',
                                   'false').lower() == 'true',
    )
    p.add_argument(
        "--long-test-prefix",
        action="store_true",
        help=
        ("Use a long prefix for the test prefix, as well as the build prefix.  Affects only "
         "Linux and Mac.  Prefix length matches the --prefix-length flag.  This is on by "
         "default in conda-build 3.0+"),
        default=cc_conda_build.get('long_test_prefix',
                                   'true').lower() == 'true',
    )
    p.add_argument(
        "--no-long-test-prefix",
        dest="long_test_prefix",
        action="store_false",
        help=
        ("Do not use a long prefix for the test prefix, as well as the build prefix."
         "  Affects only Linux and Mac.  Prefix length matches the --prefix-length flag.  "
         ),
        default=cc_conda_build.get('long_test_prefix',
                                   'true').lower() == 'true',
    )
    p.add_argument(
        '--keep-going',
        '-k',
        action='store_true',
        help=
        ("When running tests, keep going after each failure.  Default is to stop on the first "
         "failure."))
    p.add_argument(
        '--cache-dir',
        help=
        ('Path to store the source files (archives, git clones, etc.) during the build.'
         ),
        default=(abspath(
            expanduser(expandvars(cc_conda_build.get('cache_dir'))))
                 if cc_conda_build.get('cache_dir') else
                 cc_conda_build.get('cache_dir')),
    )
    p.add_argument(
        "--no-copy-test-source-files",
        dest="copy_test_source_files",
        action="store_false",
        default=cc_conda_build.get('copy_test_source_files',
                                   'true').lower() == 'true',
        help=
        ("Disables copying the files necessary for testing the package into "
         "the info/test folder.  Passing this argument means it may not be possible "
         "to test the package without internet access.  There is also a danger that "
         "the source archive(s) containing the files could become unavailable sometime "
         "in the future."))
    p.add_argument(
        '--merge-build-host',
        action="store_true",
        help=
        ('Merge the build and host directories, even when host section or compiler '
         'jinja2 is present'),
        default=cc_conda_build.get('merge_build_host',
                                   'false').lower() == 'true',
    )
    p.add_argument(
        '--stats-file',
        help=('File path to save build statistics to.  Stats are '
              'in JSON format'),
    )
    p.add_argument(
        '--extra-deps',
        nargs='+',
        help=
        ('Extra dependencies to add to all environment creation steps.  This '
         'is only enabled for testing with the -t or --test flag.  Change '
         'meta.yaml or use templates otherwise.'),
    )

    add_parser_channels(p)

    args = p.parse_args(args)
    return p, args
예제 #4
0
def parse_args(args):
    p = get_render_parser()
    p.description = """
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages."""
    p.add_argument(
        "--check",
        action="store_true",
        help="Only check (validate) the recipe.",
    )
    p.add_argument(
        "--no-anaconda-upload",
        action="store_false",
        help="Do not ask to upload the package to anaconda.org.",
        dest='anaconda_upload',
        default=binstar_upload,
    )
    p.add_argument(
        "--no-binstar-upload",
        action="store_false",
        help=argparse.SUPPRESS,
        dest='anaconda_upload',
        default=binstar_upload,
    )
    p.add_argument(
        "--no-include-recipe",
        action="store_false",
        help="Don't include the recipe inside the built package.",
        dest='include_recipe',
        default=True,
    )
    p.add_argument(
        '-s',
        "--source",
        action="store_true",
        help="Only obtain the source (but don't build).",
    )
    p.add_argument(
        '-t',
        "--test",
        action="store_true",
        help=
        "Test package (assumes package is already built).  RECIPE_DIR argument can be either "
        "recipe directory, in which case source download may be necessary to resolve package"
        "version, or path to built package .tar.bz2 file, in which case no source is necessary.",
    )
    p.add_argument(
        '--no-test',
        action='store_true',
        dest='notest',
        help="Do not test the package.",
    )
    p.add_argument(
        '-b',
        '--build-only',
        action="store_true",
        help="""Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.""",
    )
    p.add_argument(
        '-p',
        '--post',
        action="store_true",
        help=
        "Run the post-build logic. Implies --no-test and --no-anaconda-upload.",
    )
    p.add_argument(
        'recipe',
        metavar='RECIPE_PATH',
        nargs='+',
        choices=RecipeCompleter(),
        help="Path to recipe directory.  Pass 'purge' here to clean the "
        "work and test intermediates.",
    )
    p.add_argument(
        '--skip-existing',
        action='store_true',
        help="""Skip recipes for which there already exists an existing build
        (locally or in the channels). """)
    p.add_argument('--keep-old-work',
                   action='store_true',
                   dest='dirty',
                   help="Deprecated.  Same as --dirty.")
    p.add_argument(
        '--dirty',
        action='store_true',
        help='Do not remove work directory or _build environment, '
        'to speed up debugging.  Does not apply patches or download source.')
    p.add_argument(
        '-q',
        "--quiet",
        action="store_true",
        help="do not display progress bar",
    )
    p.add_argument(
        '--debug',
        action="store_true",
        help="Show debug output from source checkouts and conda",
    )
    p.add_argument('--token', help="Token to pass through to anaconda upload")
    p.add_argument(
        '--user',
        help="User/organization to upload packages to on anaconda.org or pypi")
    pypi_grp = p.add_argument_group("PyPI upload parameters (twine)")
    pypi_grp.add_argument(
        '--password', help="password to use when uploading packages to pypi")
    pypi_grp.add_argument('--sign',
                          default=False,
                          help="sign files when uploading to pypi")
    pypi_grp.add_argument(
        '--sign-with',
        default='gpg',
        dest='sign_with',
        help="program to use to sign files when uploading to pypi")
    pypi_grp.add_argument(
        '--identity',
        help="GPG identity to use to sign files when uploading to pypi")
    pypi_grp.add_argument(
        '--config-file',
        help="path to .pypirc file to use when uploading to pypi")
    pypi_grp.add_argument('--repository',
                          '-r',
                          default='pypitest',
                          help="PyPI repository to upload to")
    p.add_argument(
        "--no-activate",
        action="store_false",
        help="do not activate the build and test envs; just prepend to PATH",
        dest='activate',
    )
    p.add_argument(
        "--no-build-id",
        action="store_false",
        help=
        ("do not generate unique build folder names.  Use if having issues with "
         "paths being too long."),
        dest='set_build_id',
    )
    p.add_argument(
        "--croot",
        help=
        ("Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only "
         "to this call of conda-build."))
    p.add_argument(
        "--no-verify",
        action="store_true",
        help=("do not run verification on recipes or packages when building"))
    p.add_argument(
        "--output-folder",
        help=
        ("folder to dump output package to.  Package are moved here if build or test succeeds."
         "  Destination folder must exist prior to using this."))
    p.add_argument(
        "--no-prefix-length-fallback",
        dest='prefix_length_fallback',
        action="store_false",
        help=
        ("Disable fallback to older 80 character prefix length if environment creation"
         " fails due to insufficient prefix length in dependency packages"),
        default=True,
    )
    p.add_argument(
        "--prefix-length-fallback",
        dest='prefix_length_fallback',
        action="store_true",
        help=
        ("Disable fallback to older 80 character prefix length if environment creation"
         " fails due to insufficient prefix length in dependency packages"),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=True,
    )
    p.add_argument(
        "--prefix-length",
        dest='_prefix_length',
        help=
        ("length of build prefix.  For packages with binaries that embed the path, this is"
         " critical to ensuring that your package can run as many places as possible.  Note"
         "that this value can be altered by the OS below conda-build (e.g. encrypted "
         "filesystems on Linux), and you should prefer to set --croot to a non-encrypted "
         "location instead, so that you maintain a known prefix length."),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=255,
        type=int,
    )
    p.add_argument(
        "--no-locking",
        dest='locking',
        default=True,
        action="store_false",
        help=
        ("Disable locking, to avoid unresolved race condition issues.  Unsafe to run multiple"
         "builds at once on one system with this set."))
    p.add_argument(
        "--no-remove-work-dir",
        dest='remove_work_dir',
        default=True,
        action="store_false",
        help=
        ("Disable removal of the work dir before testing.  Be careful using this option, as"
         " you package may depend on files that are not included in the package, and may pass"
         "tests, but ultimately fail on installed systems."))
    p.add_argument(
        "--long-test-prefix",
        default=True,
        action="store_false",
        help=
        ("Use a long prefix for the test prefix, as well as the build prefix.  Affects only "
         "Linux and Mac.  Prefix length matches the --prefix-length flag.  This is on by "
         "default in conda-build 3.0+"))
    p.add_argument(
        "--no-long-test-prefix",
        dest="long_test_prefix",
        action="store_false",
        help=
        ("Do not use a long prefix for the test prefix, as well as the build prefix."
         "  Affects only Linux and Mac.  Prefix length matches the --prefix-length flag.  "
         ))
    add_parser_channels(p)

    args = p.parse_args(args)
    return p, args
예제 #5
0
def parse_args(args):
    p = get_render_parser()
    p.description = """
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages."""
    p.add_argument(
        "--check",
        action="store_true",
        help="Only check (validate) the recipe.",
    )
    p.add_argument(
        "--no-anaconda-upload",
        action="store_false",
        help="Do not ask to upload the package to anaconda.org.",
        dest='anaconda_upload',
        default=cc.binstar_upload,
    )
    p.add_argument(
        "--no-binstar-upload",
        action="store_false",
        help=argparse.SUPPRESS,
        dest='anaconda_upload',
        default=cc.binstar_upload,
    )
    p.add_argument(
        "--no-include-recipe",
        action="store_false",
        help="Don't include the recipe inside the built package.",
        dest='include_recipe',
        default=True,
    )
    p.add_argument(
        '-s',
        "--source",
        action="store_true",
        help="Only obtain the source (but don't build).",
    )
    p.add_argument(
        '-t',
        "--test",
        action="store_true",
        help=
        "Test package (assumes package is already built).  RECIPE_DIR argument can be either "
        "recipe directory, in which case source download may be necessary to resolve package"
        "version, or path to built package .tar.bz2 file, in which case no source is necessary.",
    )
    p.add_argument(
        '--no-test',
        action='store_true',
        dest='notest',
        help="Do not test the package.",
    )
    p.add_argument(
        '-b',
        '--build-only',
        action="store_true",
        help="""Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.""",
    )
    p.add_argument(
        '-p',
        '--post',
        action="store_true",
        help=
        "Run the post-build logic. Implies --no-test and --no-anaconda-upload.",
    )
    p.add_argument(
        'recipe',
        metavar='RECIPE_PATH',
        nargs='+',
        choices=RecipeCompleter(),
        help="Path to recipe directory.  Pass 'purge' here to clean the "
        "work and test intermediates.",
    )
    p.add_argument(
        '--skip-existing',
        action='store_true',
        help="""Skip recipes for which there already exists an existing build
        (locally or in the channels). """)
    p.add_argument(
        '--keep-old-work',
        action='store_true',
        help="""Keep any existing, old work directory. Useful if debugging across
        callstacks involving multiple packages/recipes. """)
    p.add_argument(
        '--dirty',
        action='store_true',
        help='Do not remove work directory or _build environment, '
        'to speed up debugging.  Does not apply patches or download source.')
    p.add_argument(
        '-q',
        "--quiet",
        action="store_true",
        help="do not display progress bar",
    )
    p.add_argument(
        '--debug',
        action="store_true",
        help="Show debug output from source checkouts and conda",
    )
    p.add_argument('--token', help="Token to pass through to anaconda upload")
    p.add_argument(
        '--user',
        help="User/organization to upload packages to on anaconda.org")
    p.add_argument(
        "--no-activate",
        action="store_false",
        help="do not activate the build and test envs; just prepend to PATH",
        dest='activate',
    )
    p.add_argument(
        "--no-build-id",
        action="store_false",
        help=
        ("do not generate unique build folder names.  Use if having issues with "
         "paths being too long."),
        dest='set_build_id',
    )
    p.add_argument(
        "--croot",
        help=
        ("Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only "
         "to this call of conda-build."))
    p.add_argument(
        "--no-verify",
        action="store_true",
        help=("do not run verification on recipes or packages when building"))

    add_parser_channels(p)

    args = p.parse_args(args)
    return p, args
예제 #6
0
def parse_args(args):
    p = get_render_parser()
    p.description = """
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages."""
    p.add_argument(
        "--check",
        action="store_true",
        help="Only check (validate) the recipe.",
    )
    p.add_argument(
        "--no-anaconda-upload",
        action="store_false",
        help="Do not ask to upload the package to anaconda.org.",
        dest='anaconda_upload',
        default=cc.binstar_upload,
    )
    p.add_argument(
        "--no-binstar-upload",
        action="store_false",
        help=argparse.SUPPRESS,
        dest='anaconda_upload',
        default=cc.binstar_upload,
    )
    p.add_argument(
        "--no-include-recipe",
        action="store_false",
        help="Don't include the recipe inside the built package.",
        dest='include_recipe',
        default=True,
    )
    p.add_argument(
        '-s', "--source",
        action="store_true",
        help="Only obtain the source (but don't build).",
    )
    p.add_argument(
        '-t', "--test",
        action="store_true",
        help="Test package (assumes package is already built).  RECIPE_DIR argument can be either "
        "recipe directory, in which case source download may be necessary to resolve package"
        "version, or path to built package .tar.bz2 file, in which case no source is necessary.",
    )
    p.add_argument(
        '--no-test',
        action='store_true',
        dest='notest',
        help="Do not test the package.",
    )
    p.add_argument(
        '-b', '--build-only',
        action="store_true",
        help="""Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.""",
    )
    p.add_argument(
        '-p', '--post',
        action="store_true",
        help="Run the post-build logic. Implies --no-test and --no-anaconda-upload.",
    )
    p.add_argument(
        'recipe',
        metavar='RECIPE_PATH',
        nargs='+',
        choices=RecipeCompleter(),
        help="Path to recipe directory.  Pass 'purge' here to clean the "
        "work and test intermediates.",
    )
    p.add_argument(
        '--skip-existing',
        action='store_true',
        help="""Skip recipes for which there already exists an existing build
        (locally or in the channels). """
    )
    p.add_argument(
        '--keep-old-work',
        action='store_true',
        dest='dirty',
        help="Deprecated.  Same as --dirty."
    )
    p.add_argument(
        '--dirty',
        action='store_true',
        help='Do not remove work directory or _build environment, '
        'to speed up debugging.  Does not apply patches or download source.'
    )
    p.add_argument(
        '-q', "--quiet",
        action="store_true",
        help="do not display progress bar",
    )
    p.add_argument(
        '--debug',
        action="store_true",
        help="Show debug output from source checkouts and conda",
    )
    p.add_argument(
        '--token',
        help="Token to pass through to anaconda upload"
    )
    p.add_argument(
        '--user',
        help="User/organization to upload packages to on anaconda.org or pypi"
    )
    pypi_grp = p.add_argument_group("PyPI upload parameters (twine)")
    pypi_grp.add_argument(
        '--password',
        help="password to use when uploading packages to pypi"
    )
    pypi_grp.add_argument(
        '--sign', default=False,
        help="sign files when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--sign-with', default='gpg', dest='sign_with',
        help="program to use to sign files when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--identity',
        help="GPG identity to use to sign files when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--config-file',
        help="path to .pypirc file to use when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--repository', default='pypi',
        help="PyPI repository to upload to"
    )
    p.add_argument(
        "--no-activate",
        action="store_false",
        help="do not activate the build and test envs; just prepend to PATH",
        dest='activate',
    )
    p.add_argument(
        "--no-build-id",
        action="store_false",
        help=("do not generate unique build folder names.  Use if having issues with "
              "paths being too long."),
        dest='set_build_id',
    )
    p.add_argument(
        "--croot",
        help=("Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only "
              "to this call of conda-build.")
    )
    p.add_argument(
        "--no-verify",
        action="store_true",
        help=("do not run verification on recipes or packages when building")
    )
    p.add_argument(
        "--output-folder",
        help=("folder to dump output package to.  Package are moved here if build or test succeeds."
              "  Destination folder must exist prior to using this.")
    )
    p.add_argument(
        "--no-prefix-length-fallback", dest='prefix_length_fallback',
        action="store_false",
        help=("Disable fallback to older 80 character prefix length if environment creation"
              " fails due to insufficient prefix length in dependency packages"),
        default=True,
    )
    p.add_argument(
        "--prefix-length-fallback", dest='prefix_length_fallback',
        action="store_true",
        help=("Disable fallback to older 80 character prefix length if environment creation"
              " fails due to insufficient prefix length in dependency packages"),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=True,
    )
    p.add_argument(
        "--prefix-length", dest='_prefix_length',
        help=("length of build prefix.  For packages with binaries that embed the path, this is"
              " critical to ensuring that your package can run as many places as possible.  Note"
              "that this value can be altered by the OS below conda-build (e.g. encrypted "
              "filesystems on Linux), and you should prefer to set --croot to a non-encrypted "
              "location instead, so that you maintain a known prefix length."),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=255, type=int,
    )
    p.add_argument(
        "--no-locking", dest='locking', default=True, action="store_false",
        help=("Disable locking, to avoid unresolved race condition issues.  Unsafe to run multiple"
              "builds at once on one system with this set.")
    )
    p.add_argument(
        "--no-remove-work-dir", dest='remove_work_dir', default=True, action="store_false",
        help=("Disable removal of the work dir before testing.  Be careful using this option, as"
              " you package may depend on files that are not included in the package, and may pass"
              "tests, but ultimately fail on installed systems.")
    )

    add_parser_channels(p)

    args = p.parse_args(args)
    return p, args
예제 #7
0
def parse_args(args):
    p = get_render_parser()
    p.description = """
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages."""
    p.add_argument(
        "--check",
        action="store_true",
        help="Only check (validate) the recipe.",
    )
    p.add_argument(
        "--no-anaconda-upload",
        action="store_false",
        help="Do not ask to upload the package to anaconda.org.",
        dest='anaconda_upload',
        default=binstar_upload,
    )
    p.add_argument(
        "--no-binstar-upload",
        action="store_false",
        help=argparse.SUPPRESS,
        dest='anaconda_upload',
        default=binstar_upload,
    )
    p.add_argument(
        "--no-include-recipe",
        action="store_false",
        help="Don't include the recipe inside the built package.",
        dest='include_recipe',
        default=cc_conda_build.get('include_recipe', 'true').lower() == 'true',
    )
    p.add_argument(
        '-s', "--source",
        action="store_true",
        help="Only obtain the source (but don't build).",
    )
    p.add_argument(
        '-t', "--test",
        action="store_true",
        help="Test package (assumes package is already built).  RECIPE_DIR argument can be either "
        "recipe directory, in which case source download may be necessary to resolve package "
        "version, or path to built package .tar.bz2 file, in which case no source is necessary.",
    )
    p.add_argument(
        '--no-test',
        action='store_true',
        dest='notest',
        help="Do not test the package.",
    )
    p.add_argument(
        '-b', '--build-only',
        action="store_true",
        help="""Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.""",
    )
    p.add_argument(
        '-p', '--post',
        action="store_true",
        help="Run the post-build logic. Implies --no-test and --no-anaconda-upload.",
    )
    p.add_argument(
        'recipe',
        metavar='RECIPE_PATH',
        nargs='+',
        help="Path to recipe directory.  Pass 'purge' here to clean the "
        "work and test intermediates.",
    )
    p.add_argument(
        '--skip-existing',
        action='store_true',
        help=("Skip recipes for which there already exists an existing build "
              "(locally or in the channels)."),
        default=cc_conda_build.get('skip_existing', 'false').lower() == 'true',
    )
    p.add_argument(
        '--keep-old-work',
        action='store_true',
        dest='keep_old_work',
        help="Do not remove anything from environment, even after successful "
             "build and test."
    )
    p.add_argument(
        '--dirty',
        action='store_true',
        help='Do not remove work directory or _build environment, '
        'to speed up debugging.  Does not apply patches or download source.'
    )
    p.add_argument(
        '-q', "--quiet",
        action="store_true",
        help="do not display progress bar",
        default=cc_conda_build.get('quiet', 'false').lower() == 'true',
    )
    p.add_argument(
        '--debug',
        action="store_true",
        help="Show debug output from source checkouts and conda",
    )
    p.add_argument(
        '--token',
        help="Token to pass through to anaconda upload",
        default=cc_conda_build.get('anaconda_token'),
    )
    p.add_argument(
        '--user',
        help="User/organization to upload packages to on anaconda.org or pypi",
        default=cc_conda_build.get('user'),
    )
    p.add_argument(
        '--label', action='append', dest='labels', default=[],
        help="Label argument to pass through to anaconda upload",
    )
    p.add_argument(
        '--no-force-upload',
        help="Disable force upload to anaconda.org, preventing overwriting any existing packages",
        dest='force_upload',
        default=True,
        action='store_false',
    )
    pypi_grp = p.add_argument_group("PyPI upload parameters (twine)")
    pypi_grp.add_argument(
        '--password',
        help="password to use when uploading packages to pypi",
    )
    pypi_grp.add_argument(
        '--sign', default=False,
        help="sign files when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--sign-with', default='gpg', dest='sign_with',
        help="program to use to sign files when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--identity',
        help="GPG identity to use to sign files when uploading to pypi"
    )
    pypi_grp.add_argument(
        '--config-file',
        help="path to .pypirc file to use when uploading to pypi",
        default=(abspath(expanduser(expandvars(cc_conda_build.get('pypirc'))))
                 if cc_conda_build.get('pypirc')
                 else cc_conda_build.get('pypirc')),
    )
    pypi_grp.add_argument(
        '--repository', '-r', help="PyPI repository to upload to",
        default=cc_conda_build.get('pypi_repository', 'pypitest'),
    )
    p.add_argument(
        "--no-activate",
        action="store_false",
        help="do not activate the build and test envs; just prepend to PATH",
        dest='activate',
        default=cc_conda_build.get('activate', 'true').lower() == 'true',
    )
    p.add_argument(
        "--no-build-id",
        action="store_false",
        help=("do not generate unique build folder names.  Use if having issues with "
              "paths being too long."),
        dest='set_build_id',
        # note: inverted - dest stores positive logic
        default=cc_conda_build.get('set_build_id', 'true').lower() == 'true',
    )
    p.add_argument(
        "--croot",
        help=("Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only "
              "to this call of conda-build.")
    )
    p.add_argument(
        "--verify",
        action="store_true",
        help="run verification on recipes or packages when building",
        default=cc_conda_build.get('verify', 'true').lower() == 'true',
    )
    p.add_argument(
        "--no-verify",
        action="store_false",
        dest="verify",
        help="do not run verification on recipes or packages when building",
        default=cc_conda_build.get('verify', 'true').lower() == 'true',
    )
    p.add_argument(
        "--strict-verify",
        action="store_true",
        dest="exit_on_verify_error",
        help="Exit if any conda-verify check fail, instead of only printing them",
        default=cc_conda_build.get('exit_on_verify_error', 'false').lower() == 'true',
    )
    p.add_argument(
        "--output-folder",
        help=("folder to dump output package to.  Package are moved here if build or test succeeds."
              "  Destination folder must exist prior to using this.")
    )
    p.add_argument(
        "--no-prefix-length-fallback", dest='prefix_length_fallback',
        action="store_false",
        help=("Disable fallback to older 80 character prefix length if environment creation"
              " fails due to insufficient prefix length in dependency packages"),
        default=True,
    )
    p.add_argument(
        "--prefix-length-fallback", dest='prefix_length_fallback',
        action="store_true",
        help=("Disable fallback to older 80 character prefix length if environment creation"
              " fails due to insufficient prefix length in dependency packages"),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=True,
    )
    p.add_argument(
        "--prefix-length", dest='_prefix_length',
        help=("length of build prefix.  For packages with binaries that embed the path, this is"
              " critical to ensuring that your package can run as many places as possible.  Note"
              "that this value can be altered by the OS below conda-build (e.g. encrypted "
              "filesystems on Linux), and you should prefer to set --croot to a non-encrypted "
              "location instead, so that you maintain a known prefix length."),
        # this default will change to false in the future, when we deem that the community has
        #     had enough time to build long-prefix length packages.
        default=255, type=int,
    )
    p.add_argument(
        "--no-locking", dest='locking', default=True, action="store_false",
        help=("Disable locking, to avoid unresolved race condition issues.  Unsafe to run multiple "
              "builds at once on one system with this set.")
    )
    p.add_argument(
        "--no-remove-work-dir", dest='remove_work_dir', default=True, action="store_false",
        help=("Disable removal of the work dir before testing.  Be careful using this option, as"
              " you package may depend on files that are not included in the package, and may pass "
              "tests, but ultimately fail on installed systems.")
    )
    p.add_argument(
        "--error-overlinking", dest='error_overlinking', action="store_true",
        help=("Enable error when shared libraries from transitive dependencies are directly "
              "linked to any executables or shared libraries in built packages.  This is disabled "
              "by default, but will be enabled by default in conda-build 4.0."),
        default=cc_conda_build.get('error_overlinking', 'false').lower() == 'true',
    )
    p.add_argument(
        "--no-error-overlinking", dest='error_overlinking', action="store_false",
        help=("Disable error when shared libraries from transitive dependencies are directly "
              "linked to any executables or shared libraries in built packages.  This is currently "
              "the default behavior, but will change in conda-build 4.0."),
        default=cc_conda_build.get('error_overlinking', 'false').lower() == 'true',
    )
    p.add_argument(
        "--long-test-prefix", default=True, action="store_false",
        help=("Use a long prefix for the test prefix, as well as the build prefix.  Affects only "
              "Linux and Mac.  Prefix length matches the --prefix-length flag.  This is on by "
              "default in conda-build 3.0+")
    )
    p.add_argument(
        "--no-long-test-prefix", dest="long_test_prefix", action="store_false",
        help=("Do not use a long prefix for the test prefix, as well as the build prefix."
              "  Affects only Linux and Mac.  Prefix length matches the --prefix-length flag.  ")
    )
    p.add_argument(
        '--keep-going', '-k', action='store_true',
        help=("When running tests, keep going after each failure.  Default is to stop on the first "
              "failure.")
    )
    p.add_argument(
        '--cache-dir',
        help=('Path to store the source files (archives, git clones, etc.) during the build.'),
        default=(abspath(expanduser(expandvars(cc_conda_build.get('cache_dir'))))
                 if cc_conda_build.get('cache_dir')
                 else cc_conda_build.get('cache_dir')),
    )
    p.add_argument(
        "--no-copy-test-source-files", dest="copy_test_source_files", action="store_false",
        default=cc_conda_build.get('copy_test_source_files', 'true').lower() == 'true',
        help=("Disables copying the files necessary for testing the package into "
              "the info/test folder.  Passing this argument means it may not be possible "
              "to test the package without internet access.  There is also a danger that "
              "the source archive(s) containing the files could become unavailable sometime "
              "in the future.")
    )
    p.add_argument(
        '--merge-build-host', action="store_true",
        help=('Merge the build and host directories, even when host section or compiler '
              'jinja2 is present'),
        default=cc_conda_build.get('merge_build_host', 'false').lower() == 'true',
    )
    p.add_argument('--stats-file', help=('File path to save build statistics to.  Stats are '
                                         'in JSON format'), )
    p.add_argument('--extra-deps',
                   nargs='+',
                   help=('Extra dependencies to add to all environment creation steps.  This '
                         'is only enabled for testing with the -t or --test flag.  Change '
                         'meta.yaml or use templates otherwise.'), )

    add_parser_channels(p)

    args = p.parse_args(args)
    return p, args
예제 #8
0
def parse_args(args):
    p = get_render_parser()
    p.description = """
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages."""
    p.add_argument(
        "--check",
        action="store_true",
        help="Only check (validate) the recipe.",
    )
    p.add_argument(
        "--no-anaconda-upload",
        action="store_false",
        help="Do not ask to upload the package to anaconda.org.",
        dest='anaconda_upload',
        default=cc.binstar_upload,
    )
    p.add_argument(
        "--no-binstar-upload",
        action="store_false",
        help=argparse.SUPPRESS,
        dest='anaconda_upload',
        default=cc.binstar_upload,
    )
    p.add_argument(
        "--no-include-recipe",
        action="store_false",
        help="Don't include the recipe inside the built package.",
        dest='include_recipe',
        default=True,
    )
    p.add_argument(
        '-s', "--source",
        action="store_true",
        help="Only obtain the source (but don't build).",
    )
    p.add_argument(
        '-t', "--test",
        action="store_true",
        help="Test package (assumes package is already built).  RECIPE_DIR argument can be either "
        "recipe directory, in which case source download may be necessary to resolve package"
        "version, or path to built package .tar.bz2 file, in which case no source is necessary.",
    )
    p.add_argument(
        '--no-test',
        action='store_true',
        dest='notest',
        help="Do not test the package.",
    )
    p.add_argument(
        '-b', '--build-only',
        action="store_true",
        help="""Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.""",
    )
    p.add_argument(
        '-p', '--post',
        action="store_true",
        help="Run the post-build logic. Implies --no-test and --no-anaconda-upload.",
    )
    p.add_argument(
        'recipe',
        metavar='RECIPE_PATH',
        nargs='+',
        choices=RecipeCompleter(),
        help="Path to recipe directory.  Pass 'purge' here to clean the "
        "work and test intermediates.",
    )
    p.add_argument(
        '--skip-existing',
        action='store_true',
        help="""Skip recipes for which there already exists an existing build
        (locally or in the channels). """
    )
    p.add_argument(
        '--keep-old-work',
        action='store_true',
        help="""Keep any existing, old work directory. Useful if debugging across
        callstacks involving multiple packages/recipes. """
    )
    p.add_argument(
        '--dirty',
        action='store_true',
        help='Do not remove work directory or _build environment, '
        'to speed up debugging.  Does not apply patches or download source.'
    )
    p.add_argument(
        '-q', "--quiet",
        action="store_true",
        help="do not display progress bar",
    )
    p.add_argument(
        '--debug',
        action="store_true",
        help="Show debug output from source checkouts and conda",
    )
    p.add_argument(
        '--token',
        help="Token to pass through to anaconda upload"
    )
    p.add_argument(
        '--user',
        help="User/organization to upload packages to on anaconda.org"
    )
    p.add_argument(
        "--no-activate",
        action="store_false",
        help="do not activate the build and test envs; just prepend to PATH",
        dest='activate',
    )
    p.add_argument(
        "--no-build-id",
        action="store_false",
        help=("do not generate unique build folder names.  Use if having issues with "
              "paths being too long."),
        dest='set_build_id',
    )
    p.add_argument(
        "--croot",
        help=("Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only "
              "to this call of conda-build.")
    )
    p.add_argument(
        "--no-verify",
        action="store_true",
        help=("do not run verification on recipes or packages when building")
    )
    p.add_argument(
        "--output-folder",
        help=("folder to dump output package to.  Package are moved here if build or test succeeds."
              "  Destination folder must exist prior to using this.")
    )

    add_parser_channels(p)

    args = p.parse_args(args)
    return p, args