How to use the param.version.Version function in param

To help you get started, we’ve selected a few param 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 holoviz / param / tests / testversion.py View on Github external
def test_version_v1_commit_count(self):
        v1 = Version(release=(1,0))
        self.assertEqual(v1.commit_count, 0)
github holoviz / param / tests / testversion.py View on Github external
def test_version_less_than_dev_number(self):
        v101dev1 = Version(release=(1,0,1), dev=1)
        v101dev2 = Version(release=(1,0,1), dev=2)
        self.assertEqual((v101dev1 < v101dev2), True)
github holoviz / param / tests / testversion.py View on Github external
def test_version_v1_dirty(self):
        v1 = Version(release=(1,0))
        self.assertEqual(v1.dirty, False)
github holoviz / param / tests / testversion.py View on Github external
def test_version_eq_v101(self):
        v101 = Version(release=(1,0,1))
        self.assertEqual(v101==v101, True)
github holoviz / param / tests / testversion.py View on Github external
def test_version_less_than_dev_number(self):
        v101dev1 = Version(release=(1,0,1), dev=1)
        v101dev2 = Version(release=(1,0,1), dev=2)
        self.assertEqual((v101dev1 < v101dev2), True)
github holoviz / param / tests / testversion.py View on Github external
def test_version_release_v101(self):
        v101 = Version(release=(1,0,1))
        self.assertEqual(v101.release, (1,0,1))
github holoviz / param / tests / testversion.py View on Github external
def test_version_init_v101(self):
        Version(release=(1,0,1))
github holoviz / param / tests / testversion.py View on Github external
def test_version_greater_than_dev(self):
        v101 = Version(release=(1,0,1))
        v102dev3 = Version(release=(1,0,2), dev=3)
        self.assertEqual((v102dev3 > v101), True)
github holoviz / param / param / version.py View on Github external
The dirty policy can be one of 'report', 'strip', 'raise'. If it is
        'report' the version string may end in '-dirty' if the repository is
        in a dirty state.  If the policy is 'strip', the '-dirty' suffix
        will be stripped out if present. If the policy is 'raise', an
        exception is raised if the repository is in a dirty state. This can
        be useful if you want to make sure packages are not built from a
        dirty repository state.
        """
        pkgname = reponame if pkgname is None else pkgname
        policies = ['raise','report', 'strip']
        if dirty not in policies:
            raise AssertionError("get_setup_version dirty policy must be in %r" % policies)

        fpath = os.path.join(setup_path, pkgname, "__init__.py")
        version = Version(fpath=fpath, reponame=reponame, archive_commit=archive_commit)
        if describe:
            vstring = version.git_fetch(as_string=True)
        else:
            vstring = str(version)

        if version.dirty and dirty == 'raise':
            raise AssertionError('Repository is in a dirty state.')
        elif version.dirty and dirty=='strip':
            return vstring.replace('-dirty', '')
        else:
            return vstring
github holoviz / param / param / version.py View on Github external
if git_describe is not None:
                info['git_describe'] = git_describe
        except: pass

        if git_describe is None:
            extracted_directory_tag = Version.extract_directory_tag(setup_path, reponame)
            if extracted_directory_tag is not None:
                info['extracted_directory_tag'] = extracted_directory_tag
            try:
                with open(os.path.join(setup_path, pkgname, '.version'), 'w') as f:
                    f.write(json.dumps({'extracted_directory_tag':extracted_directory_tag}))
            except:
                print('Error in setup_version: could not write .version file.')


        info['version_string'] =  Version.get_setup_version(setup_path,
                                                            reponame,
                                                            describe=False,
                                                            dirty=dirty,
                                                            pkgname=pkgname,
                                                            archive_commit=archive_commit)
        try:
            with open(os.path.join(setup_path, pkgname, '.version'), 'w') as f:
                f.write(json.dumps(info))
        except:
            print('Error in setup_version: could not write .version file.')

        return info['version_string']