

def get_cmdclass():
    if ('versioneer' in sys.modules):
        del sys.modules['versioneer']
    cmds = {
        
    }
    from distutils.core import Command

    class cmd_version(Command):
        description = 'report generated version string'
        user_options = []
        boolean_options = []

        def initialize_options(self):
            pass

        def finalize_options(self):
            pass

        def run(self):
            vers = get_versions(verbose=True)
            print(('Version: %s' % vers['version']))
            print((' full-revisionid: %s' % vers.get('full-revisionid')))
            print((' dirty: %s' % vers.get('dirty')))
            if vers['error']:
                print((' error: %s' % vers['error']))
    cmds['version'] = cmd_version
    from distutils.command.build_py import build_py as _build_py

    class cmd_build_py(_build_py):

        def run(self):
            root = get_root()
            cfg = get_config_from_root(root)
            versions = get_versions()
            _build_py.run(self)
            if cfg.versionfile_build:
                target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build)
                print(('UPDATING %s' % target_versionfile))
                write_to_version_file(target_versionfile, versions)
    cmds['build_py'] = cmd_build_py
    if ('cx_Freeze' in sys.modules):
        from cx_Freeze.dist import build_exe as _build_exe

        class cmd_build_exe(_build_exe):

            def run(self):
                root = get_root()
                cfg = get_config_from_root(root)
                versions = get_versions()
                target_versionfile = cfg.versionfile_source
                print(('UPDATING %s' % target_versionfile))
                write_to_version_file(target_versionfile, versions)
                _build_exe.run(self)
                os.unlink(target_versionfile)
                with open(cfg.versionfile_source, 'w') as f:
                    LONG = LONG_VERSION_PY[cfg.VCS]
                    f.write((LONG % {
                        'DOLLAR': '$',
                        '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']
    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
            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)
            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)
    cmds['sdist'] = cmd_sdist
    return cmds

dataset/ETHPy150Open Anaconda-Platform/chalmers/versioneer.py get_cmdclass/original