How to use the wheel.bdist_wheel function in wheel

To help you get started, we’ve selected a few wheel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asottile / dockerfile / setup.py View on Github external
from setuptools import Extension
from setuptools import setup

if not os.path.exists('vendor/github.com/moby/buildkit/frontend'):
    print('moby checkout is missing!')
    print('Run `git submodule update --init`')
    exit(1)

if sys.platform != 'win32' and platform.python_implementation() == 'CPython':
    try:
        import wheel.bdist_wheel
    except ImportError:
        cmdclass = {}
    else:
        class bdist_wheel(wheel.bdist_wheel.bdist_wheel):
            def finalize_options(self) -> None:
                self.py_limited_api = f'cp3{sys.version_info[1]}'
                super().finalize_options()

        cmdclass = {'bdist_wheel': bdist_wheel}
else:
    cmdclass = {}

setup(
    ext_modules=[
        Extension(
            'dockerfile', ['pylib/main.go'],
            py_limited_api=True, define_macros=[('Py_LIMITED_API', None)],
        ),
    ],
    cmdclass=cmdclass,
github priyankcommits / pyfiddleio / pyfiddle_executer / wheel / egg2wheel.py View on Github external
dist_info = "%s-%s" % (egg_info['name'], egg_info['ver'])
    abi = 'none'
    pyver = egg_info['pyver'].replace('.', '')
    arch = (egg_info['arch'] or 'any').replace('.', '_').replace('-', '_')
    if arch != 'any':
        # assume all binary eggs are for CPython
        pyver = 'cp' + pyver[2:]
    wheel_name = '-'.join((
                          dist_info,
                          pyver,
                          abi,
                          arch
                          ))
    root_is_purelib = egg_info['arch'] is None
    if root_is_purelib:
        bw = wheel.bdist_wheel.bdist_wheel(distutils.dist.Distribution())
    else:
        bw = _bdist_wheel_tag(distutils.dist.Distribution())

    bw.root_is_pure = root_is_purelib
    bw.python_tag = pyver
    bw.plat_name_supplied = True
    bw.plat_name = egg_info['arch'] or 'any'
    if not root_is_purelib:
        bw.full_tag_supplied = True
        bw.full_tag = (pyver, abi, arch)

    dist_info_dir = os.path.join(dir, '%s.dist-info' % dist_info)
    bw.egg2dist(os.path.join(dir, 'EGG-INFO'),
                dist_info_dir)
    bw.write_wheelfile(dist_info_dir, generator='egg2wheel')
    bw.write_record(dir, dist_info_dir)
github Nuitka / Nuitka / nuitka / distutils / bdist_nuitka.py View on Github external
def write_wheelfile(self, wheelfile_base, generator=None):
        if generator is None:
            from nuitka.Version import getNuitkaVersion

            generator = "Nuitka (%s)" % getNuitkaVersion()

        wheel.bdist_wheel.bdist_wheel.write_wheelfile(
            self, wheelfile_base=wheelfile_base, generator=generator
        )
github openstack / releases / openstack_releases / links.py View on Github external
def wheel_py3_url(version, project):
    repo_base = project.repo.base_name
    base = project.tarball_base or repo_base
    return '{s}/{r}/{n}-{v}-py3-none-any.whl'.format(
        s='https://tarballs.openstack.org',
        v=version,
        r=repo_base,
        n=wheel.bdist_wheel.safer_name(base),
    )
github pantsbuild / pex / pex / vendor / _vendored / wheel / wheel / egg2wheel.py View on Github external
shutil.copy2(src, dir)
            else:
                shutil.copytree(src, os.path.join(dir, pth))

    pyver = egg_info['pyver']
    if pyver:
        pyver = pyver.replace('.', '')

    arch = (egg_info['arch'] or 'any').replace('.', '_').replace('-', '_')

    # assume all binary eggs are for CPython
    abi = 'cp' + pyver[2:] if arch != 'any' else 'none'

    root_is_purelib = egg_info['arch'] is None
    if root_is_purelib:
        bw = wheel.bdist_wheel.bdist_wheel(distutils.dist.Distribution())
    else:
        bw = _bdist_wheel_tag(distutils.dist.Distribution())

    bw.root_is_pure = root_is_purelib
    bw.python_tag = pyver
    bw.plat_name_supplied = True
    bw.plat_name = egg_info['arch'] or 'any'
    if not root_is_purelib:
        bw.full_tag_supplied = True
        bw.full_tag = (pyver, abi, arch)

    dist_info_dir = os.path.join(dir, '{name}-{ver}.dist-info'.format(**egg_info))
    bw.egg2dist(os.path.join(dir, 'EGG-INFO'), dist_info_dir)
    bw.write_wheelfile(dist_info_dir, generator='egg2wheel')
    bw.write_record(dir, dist_info_dir)
    wheel_name = '{name}-{ver}-{pyver}-{}-{}'.format(abi, arch, **egg_info)
github Nuitka / Nuitka / nuitka / distutils / bdist_nuitka.py View on Github external
# Delete the entire source copy of the module
            shutil.rmtree(os.path.join(self.build_lib, self.main_package))


# pylint: disable=C0103
class install(distutils.command.install.install):

    # pylint: disable=attribute-defined-outside-init
    def finalize_options(self):
        distutils.command.install.install.finalize_options(self)
        # Ensure the purelib folder is not used
        self.install_lib = self.install_platlib


# pylint: disable=C0103
class bdist_nuitka(wheel.bdist_wheel.bdist_wheel):
    def initialize_options(self):
        # Register the command class overrides above
        dist = self.distribution
        dist.cmdclass = dist.cmdclass or {}  # Ensure is a dict
        dist.cmdclass["build"] = build
        dist.cmdclass["install"] = install

        wheel.bdist_wheel.bdist_wheel.initialize_options(self)

    # pylint: disable=attribute-defined-outside-init
    def finalize_options(self):
        wheel.bdist_wheel.bdist_wheel.finalize_options(self)
        # Force module to use correct platform in name
        self.root_is_pure = False
        self.plat_name_supplied = self.plat_name is not None
github dheerajchand / ubuntu-django-nginx-ansible / projectenv / lib / python2.7 / site-packages / wheel / wininst2wheel.py View on Github external
# architecture-specific (because the format itself is).
    # So, assume the content is architecture-neutral if root is purelib.
    if root_is_purelib:
        arch = 'any'
    # If the installer is architecture-specific, it's almost certainly also
    # CPython-specific.
    if arch != 'any':
        pyver = pyver.replace('py', 'cp')
    wheel_name = '-'.join((
                          dist_info,
                          pyver,
                          abi,
                          arch
                          ))
    if root_is_purelib:
        bw = wheel.bdist_wheel.bdist_wheel(distutils.dist.Distribution())
    else:
        bw = _bdist_wheel_tag(distutils.dist.Distribution())

    bw.root_is_pure = root_is_purelib
    bw.python_tag = pyver
    bw.plat_name_supplied = True
    bw.plat_name = info['arch'] or 'any'

    if not root_is_purelib:
        bw.full_tag_supplied = True
        bw.full_tag = (pyver, abi, arch)

    dist_info_dir = os.path.join(dir, '%s.dist-info' % dist_info)
    bw.egg2dist(os.path.join(dir, egginfo_name), dist_info_dir)
    bw.write_wheelfile(dist_info_dir, generator='wininst2wheel')
    bw.write_record(dir, dist_info_dir)
github hynek / argon2-cffi / setup.py View on Github external
objects, lib_name, output_dir=self.build_clib, debug=self.debug
            )


if (
    sys.platform != "win32"
    and sys.version_info > (3,)
    and platform.python_implementation() == "CPython"
):
    try:
        import wheel.bdist_wheel
    except ImportError:
        BDistWheel = None
    else:

        class BDistWheel(wheel.bdist_wheel.bdist_wheel):
            def finalize_options(self):
                self.py_limited_api = "cp3{}".format(sys.version_info[1])
                wheel.bdist_wheel.bdist_wheel.finalize_options(self)


else:
    BDistWheel = None


if __name__ == "__main__":
    setup(
        name=NAME,
        description=find_meta("description"),
        license=find_meta("license"),
        url=URL,
        project_urls=PROJECT_URLS,
github hynek / argon2-cffi / setup.py View on Github external
def finalize_options(self):
                self.py_limited_api = "cp3{}".format(sys.version_info[1])
                wheel.bdist_wheel.bdist_wheel.finalize_options(self)