How to use the setuptools.command.sdist.sdist function in setuptools

To help you get started, we’ve selected a few setuptools 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 mattboyer / sqbrite / setup.py View on Github external
from setuptools.command.sdist import sdist as SetuptoolsSdist
from setuptools import setup, find_packages
import os
import shutil

import version
from src import PROJECT_NAME, PROJECT_DESCRIPTION, README_PATH


class SdistAndClean(SetuptoolsSdist):
    '''
    Runs the default setuptools sdist command and then cleans the egg info
    directory.
    '''

    def run(self):
        SetuptoolsSdist.run(self)

        # FIXME This works, but there *has* to be a cleaner way
        for distfile in self.filelist.files:
            if distfile.endswith('PKG-INFO'):
                egginfo_dir = os.path.dirname(distfile)
                shutil.rmtree(egginfo_dir)


def package_names():
github gabrieldemarmiesse / python-autopxd2 / setup.py View on Github external
setup(
    name='autopxd2',
    version=VERSION,
    description='Automatically generate Cython pxd files from C headers',
    long_description=long_description,
    long_description_content_type="text/markdown",
    packages=['autopxd'],
    package_data={'autopxd': PACKAGE_DATA},
    author='Gabriel de Marmiesse',
    author_email='gabrieldemarmiesse@gmail.com',
    url=REPO,
    license='MIT',
    cmdclass={
        'develop': install_libc_headers_and(develop),
        'install': install_libc_headers_and(install),
        'sdist': install_libc_headers_and(sdist)
    },
    install_requires=[
        'six',
        'Click',
        'pycparser',
    ],
    extras_require={
        'dev': [
            'pytest',
            'pycodestyle'
        ]
    },
    entry_points='''
    [console_scripts]
github hotdoc / hotdoc / setup.py View on Github external
self.run_command('build_default_theme')
        self.run_command('link_pre_commit_hook')
        return develop.run(self)


# pylint: disable=missing-docstring
class CustomBuild(build):

    def run(self):
        if not os.path.exists(THEME_DIST_DIR):
            self.run_command('build_default_theme')
        return build.run(self)


# pylint: disable=missing-docstring
class CustomSDist(sdist):

    def run(self):
        self.run_command('build_default_theme')
        return sdist.run(self)


class CustomBuildExt(build_ext):
    def run(self):
        for extension in self.extensions:
            if hasattr(extension, 'build_custom'):
                extension.build_custom()

        build_ext.run(self)
        return True
github warner / python-ecdsa / versioneer.py View on Github external
def make_release_tree(self, base_dir, files):
            root = get_root()
            cfg = get_config_from_root(root)
            _sdist.make_release_tree(self, base_dir, files)
            # now locate _version.py in the new base_dir directory
            # (remembering that it may be a hardlink) and replace it with an
            # updated value
            target_versionfile = os.path.join(base_dir, cfg.versionfile_source)
            print("UPDATING %s" % target_versionfile)
            write_to_version_file(
                target_versionfile, self._versioneer_generated_versions
            )
github geometalab / OSMDeepOD / versioneer.py View on Github external
"STYLE": cfg.style,
                             "TAG_PREFIX": cfg.tag_prefix,
                             "PARENTDIR_PREFIX": cfg.parentdir_prefix,
                             "VERSIONFILE_SOURCE": cfg.versionfile_source,
                             })

        cmds["build_exe"] = cmd_build_exe
        del cmds["build_py"]

    # we override different "sdist" commands for both environments
    if "setuptools" in sys.modules:
        from setuptools.command.sdist import sdist as _sdist
    else:
        from distutils.command.sdist import sdist as _sdist

    class cmd_sdist(_sdist):
        def run(self):
            versions = get_versions()
            self._versioneer_generated_versions = versions
            # unless we update this, the command will keep using the old
            # version
            self.distribution.metadata.version = versions["version"]
            return _sdist.run(self)

        def make_release_tree(self, base_dir, files):
            root = get_root()
            cfg = get_config_from_root(root)
            _sdist.make_release_tree(self, base_dir, files)
            # now locate _version.py in the new base_dir directory
            # (remembering that it may be a hardlink) and replace it with an
            # updated value
            target_versionfile = os.path.join(base_dir, cfg.versionfile_source)
github vispy / vispy / setup.py View on Github external
'3D',
        'plotting',
        'numpy',
        'bigdata',
        'ipython',
        'jupyter',
        'widgets',
    ],
    description=description,
    long_description=readme,
    platforms='any',
    provides=['vispy'],
    cmdclass={
        'build_py': js_prerelease(build_py),
        'egg_info': js_prerelease(egg_info),
        'sdist': js_prerelease(sdist, strict=True),
        'jsdeps': NPM,
    },
    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
    install_requires=['numpy', 'freetype-py'],
    setup_requires=['numpy', 'cython', 'setuptools_scm', 'setuptools_scm_git_archive'],
    extras_require={
        'ipython-static': ['ipython'],
        'ipython-vnc': ['ipython>=7'],
        'ipython-webgl': ['ipywidgets>=7.0', 'ipython>=7', 'tornado'],
        'pyglet': ['pyglet>=1.2'],
        'pyqt5': ['pyqt5'],
        'pyside': ['PySide'],
        'pyside2': ['PySide2'],
        'sdl2': ['PySDL2'],
        'wx': ['wxPython'],
        'doc': ['sphinx_bootstrap_theme', 'numpydoc'],
github google / grr / colab / setup.py View on Github external
def get_config():
  """Get INI parser with version.ini data."""
  # TODO(hanuszczak): See comment in `setup.py` for `grr-response-proto`.
  ini_path = os.path.join(THIS_DIRECTORY, "version.ini")
  if not os.path.exists(ini_path):
    ini_path = os.path.join(THIS_DIRECTORY, "../version.ini")
    if not os.path.exists(ini_path):
      raise RuntimeError("Couldn't find version.ini")

  config = configparser.SafeConfigParser()
  config.read(ini_path)
  return config


class Sdist(sdist):
  """Build sdist."""

  def make_release_tree(self, base_dir, files):
    sdist.make_release_tree(self, base_dir, files)

    sdist_version_ini = os.path.join(base_dir, "version.ini")
    if os.path.exists(sdist_version_ini):
      os.unlink(sdist_version_ini)
    shutil.copy(
        os.path.join(THIS_DIRECTORY, "../version.ini"), sdist_version_ini)


VERSION = get_config()

setup(
    name="grr-colab",
github opsdroid / opsdroid / setup.py View on Github external
def run(self):
        self.run_command("compile_catalog")
        sdist.run(self)  # old style class
github catboost / catboost / catboost / python-package / setup.py View on Github external
'BUILD_ROOT=' + build_dir,
            'SOURCE_ROOT=' + topsrc_dir,
        ]
        if self.parallel is not None:
            make_cmd += ['-j', str(self.parallel)]
        logging_execute(make_cmd, verbose, dry_run)
        logging.info('Successfully built {} with{} CUDA support'.format(catboost_ext, '' if self.with_cuda else 'out'))
        dll = os.path.join(build_dir, 'catboost', 'python-package', 'catboost', catboost_ext)
        distutils.file_util.copy_file(dll, put_dir, verbose=verbose, dry_run=dry_run)

    def build_with_msbuild(self, topsrc_dir, build_dir, catboost_ext, put_dir, verbose, dry_run):
        logging.info('Buildling {} with msbuild'.format(catboost_ext))
        raise ValueError('TODO: build with msbuild')


class sdist(_sdist):

    def make_release_tree(self, base_dir, files):
        _sdist.make_release_tree(self, base_dir, files)
        copy_catboost_sources(
            os.path.join(SETUP_DIR, '..', '..'),
            os.path.join(base_dir, EXT_SRC),
            verbose=self.distribution.verbose,
            dry_run=self.distribution.dry_run,
        )


if __name__ == '__main__':
    logging.basicConfig(format='%(asctime)s %(levelname)1.1s %(msg)s', level=logging.DEBUG, datefmt=emph('%X'))
    setup(
        name=os.environ.get('CATBOOST_PACKAGE_NAME') or 'catboost',
        version=os.environ.get('CATBOOST_PACKAGE_VERSION') or guess_catboost_version(),
github InsightSoftwareConsortium / itkwidgets / setup.py View on Github external
'itk-meshtopolydata>=0.5.1',
        'ipydatawidgets>=4.0.1',
        'ipywidgets>=7.5.1',
        'ipympl',
        'matplotlib',
        'numpy',
        'scipy',
        'six',
        'zstandard',
    ],
    'packages': find_packages(),
    'zip_safe': False,
    'cmdclass': {
        'build_py': js_prerelease(build_py),
        'egg_info': js_prerelease(egg_info),
        'sdist': js_prerelease(sdist, strict=True),
        'jsdeps': NPM,
    },

    'author': 'Matthew McCormick',
    'author_email': 'matt.mccormick@kitware.com',
    'url': 'https://github.com/InsightSoftwareConsortium/itkwidgets',
    'keywords': [
        'ipython',
        'jupyter',
        'jupyterlab-extension',
        'widgets',
        'itk',
        'imaging',
        'visualization',
        'webgl',
    ],