Beispiel #1
0
    def test_interleaved_discovery(self):
        """
        When the search is cached, it is
        possible for searches to be interleaved, so make sure
        those use-cases are safe.

        Ref #293
        """
        dists = distributions()
        next(dists)
        version('importlib_metadata')
        next(dists)
Beispiel #2
0
    async def _on_module_opened(self, event: Event, sender: str) -> bool:
        """React to other modules connecting."""
        if sender == self.comm.name or not isinstance(event,
                                                      ModuleOpenedEvent):
            return False

        # get proxy and version
        proxy = await self.proxy(sender, IModule)
        try:
            module_version = await proxy.get_version()
        except exc.RemoteError:
            return True

        # log it
        log.debug(
            f"Other module {sender} found, running on pyobs {module_version}.")

        # check version, only compare major and minor, ignore patch level
        v1, v2 = packaging.version.parse(
            version()), packaging.version.parse(module_version)
        if v1.major != v2.major or v1.minor != v2.minor:
            log.critical(
                f'Found module "{sender}" with different pyobs version {module_version} (≠{version()}), '
                f"please update pyobs.")

        # okay
        return True
Beispiel #3
0
 def _check_for_updates(self):
     try:
         new_version = check_newest_release(ReleaseType.SKYTEMPLE)
         if packaging.version.parse(version()) < packaging.version.parse(new_version):
             self.builder.get_object('update_new_version').set_text(new_version)
             return
     except Exception:
         pass
     # else/except:
     self.builder.get_object('update_info').hide()
Beispiel #4
0
def upd_version_with_circuit():
    if answers.get('upgrade') == 'patch':
        version('package.json', 2)

        if args.circuit:
            if replies.get('circuit') == 'csp':
                version('appCsp.json', 2)
            elif replies.get('circuit') == 'sahalin':
                version('appSahalin.json', 2)

    if answers.get('upgrade') == 'minor':
        minor('package.json')

        if args.circuit:
            if replies.get('circuit') == 'csp':
                minor('appCsp.json')

            elif replies.get('circuit') == 'sahalin':
                minor('appSahalin.json')

    if answers.get('upgrade') == 'major':
        major('package.json')

        if args.circuit:
            if replies.get('circuit') == 'csp':
                major('appCsp.json')

            elif replies.get('circuit') == 'sahalin':
                major('appSahalin.json')
Beispiel #5
0
    def on_settings_about_clicked(self, *args):
        about: Gtk.AboutDialog = self.builder.get_object("about_dialog")
        about.connect("response", lambda d, r: d.hide())

        def activate_link(l, uri, *args):
            webbrowser.open_new_tab(uri)
            return True

        about.connect("activate-link", activate_link)
        header_bar: Optional[Gtk.HeaderBar] = about.get_header_bar()
        if header_bar is not None:
            # Cool bug??? And it only works on the left as well, wtf?
            header_bar.set_decoration_layout('close')
        about.set_version(version())
        about.run()
Beispiel #6
0
def check_version_tag():
    """Before releasing, check that the version matches the git tag"""
    git_describe_version = git_describe()
    setuppy_version = version()
    if setuppy_version == git_describe_version:
        print("Versions match.")
    elif 'dirty' in git_describe_version:
        raise ValueError("""Working directory has uncommited changes.\
            Commit before releasing.""")
    else:
        choice = input("Release without tagging\n(version {0})? [y/N]\n".format(
            setuppy_version)).lower()
        if choice[0] == 'y':
            print("Continuing")
        else:
            raise ValueError("Stopping.")
Beispiel #7
0
def check_version_tag():
    """Before releasing, check that the version matches the git tag"""
    git_describe_version = git_describe()
    setuppy_version = version()
    if setuppy_version == git_describe_version:
        print("Versions match.")
    elif 'dirty' in git_describe_version:
        raise ValueError("""Working directory has uncommited changes.\
            Commit before releasing.""")
    else:
        choice = input(
            "Release without tagging\n(version {0})? [y/N]\n".format(
                setuppy_version)).lower()
        if choice[0] == 'y':
            print("Continuing")
        else:
            raise ValueError("Stopping.")
Beispiel #8
0
import sys

import packaging.version

# Import this now because we need it below
from pip_api._version import version

PIP_VERSION = packaging.version.parse(version())
PYTHON_VERSION = sys.version_info

# Import these because they depend on the above
from pip_api._hash import hash  # noqa
Beispiel #9
0
    maximum_min_maj()

# --bundle --circuit
# меняется version, expo.version - нужно выбрать дополнительный файл - csp / sahalin
elif args.bundle and args.circuit:
    os.system('echo bundle')
    upd_version_with_circuit()
    alignment()
    maximum_min_maj()

# --build
# меняется version(package.json), buildNumber, versionCode и в sahalin и csp
elif args.build and not args.circuit:
    os.system('echo build csp and sahalin')
    if answers.get('upgrade') == 'patch':
        version('package.json', 2)
        version('appCsp.json', 2)  # expo.version  - csp
        version('appSahalin.json', 2)  # expo.version - sahalin
    elif answers.get('upgrade') == 'minor':
        minor('package.json')
        minor('appCsp.json')
        minor('appSahalin.json')
    elif answers.get('upgrade') == 'major':
        major('package.json')
        major('appSahalin.json')
        major('appCsp.json')
    increase_special_fields('appCsp.json')
    increase_special_fields('appSahalin.json')
    alignment()

#  --bundle
Beispiel #10
0
 def is_installed(package_spec):
     req = packaging.requirements.Requirement(package_spec)
     return version(req.name) in req.specifier
Beispiel #11
0
def check_version():
    """Raise an error if the version number is not PEP440 compatible"""
    packaging.version.Version(version())
    print("Version okay.")
Beispiel #12
0
 async def get_version(self, **kwargs: Any) -> str:
     """Returns pyobs version of module."""
     return version()
Beispiel #13
0
def check_version():
    """Raise an error if the version number is not PEP440 compatible"""
    packaging.version.Version(version())
    print("Version okay.")
Beispiel #14
0
import json
import requests
from packaging import version
import sys

def version(package):
    url = "https://pypi.python.org/pypi/%s/json" % package
    data = requests.get(url).json()
    versions = sorted(data['releases'])
    #versions = sorted(data['releases'], key=version.parse())
    #versions.sort(key=version.parse)
    return versions


print ("\n", version(sys.argv[1]))