コード例 #1
0
    def mpy_mismatch(self):
        """
        Returns a boolean to indicate if this module's MPY version is compatible
        with the board's current version of Circuitpython. A min or max version
        that evals to False means no limit.

        :return: Boolean indicating if the MPY versions don't match.
        """
        if not self.mpy:
            return False
        try:
            cpv = VersionInfo.parse(CPY_VERSION)
        except ValueError as ex:
            logger.warning("CircuitPython has incorrect semver value.")
            logger.warning(ex)
        try:
            if self.min_version and cpv < VersionInfo.parse(self.min_version):
                return True  # CP version too old
            if self.max_version and cpv >= VersionInfo.parse(self.max_version):
                return True  # MPY version too old
        except (TypeError, ValueError) as ex:
            logger.warning(
                "Module '%s' has incorrect MPY compatibility information.",
                self.name)
            logger.warning(ex)
        return False
コード例 #2
0
def compare_version_compatibility(
    eva_version: str,
    eva_requirements: EvaVersionRequirements,
    sdk_version: str = __version__,
) -> Union[str, None]:
    """Checks to see if the given SDK version is compatible with the given software version
    of Eva, in order to decipher the compatibility, we pass in a requirement configuration.
    Pass in sdk_version so that we aren't reliant upon __version__ and thus tests
    don't have to be updated on updating __version__.
    Args:
        eva_version (str): SemVer formated version of Eva software
        eva_requirements (EvaVersionRequirements): Eva version requirements.
        sdk_version (str, optional): SemVer formated version of the SDK. Defaults to __version__.
    Returns:
        str: An error string if there is one, empty implies compatible.
    """
    try:
        VersionInfo.parse(
            sdk_version)  # checks SemVer validity of SDK version.
        eva_v = VersionInfo.parse(eva_version)
        min_req_satisfied = eva_v.compare(eva_requirements.min) >= 0
        max_req_satisfied = eva_v.compare(eva_requirements.max) < 0
    except ValueError as e:
        return str(e)
    if not max_req_satisfied or not min_req_satisfied:
        return f'Eva is version "{eva_version}". Current SDK version is "{sdk_version}", {eva_requirements.message()}'
    return None
コード例 #3
0
ファイル: porter.py プロジェクト: CrashenX/bi
 def import_json(cls, path, dbname):
     data = None
     crypto = Crypto(dbname)
     print("Importing %s .." % path, end='')
     stdout.flush()
     try:
         f = open(path)
         with f:
             data = loads(f.read())
             version = VersionInfo.parse(data.get('version', ""))
             for v in cls.supported:
                 if version <= VersionInfo.parse(v.version()):
                     data = v.correct(data)
             data['version'] = cls.current.version()
             data = cls.current.encrypt(data, crypto)
     except Exception as e:
         print(". %s; " % e, end='')
         Printer.color("nothing imported", False)
         return
     print(".")
     client = MongoClient()
     with client:
         db = getattr(client, dbname)
         for name in cls.current.tables():
             table = getattr(db, name)
             print("  ... deleting old %s .." % name, end='')
             stdout.flush()
             table.drop()
             print(". importing new %s .." % name, end='')
             stdout.flush()
             records = data.get(name, [])
             for r in records:
                 table.insert_one(r)
             print('. ', end='')
             Printer.color('%d %s imported' % (len(records), name), True)
コード例 #4
0
ファイル: conf.py プロジェクト: TangleInc/release-tool
    def _get_version(self) -> VersionInfo:
        hook_result = self.hooks.get_version()()
        proposed_version = VersionInfo.parse(hook_result.strip())

        print(f"Current version: {proposed_version}")

        if self.require_creation_of_release_branch:
            proposed_version = VersionInfo.parse(
                bump_minor(str(proposed_version)))
        if self.require_creation_of_hotfix_branch:
            proposed_version = VersionInfo.parse(
                bump_patch(str(proposed_version)))

        if self.no_input:
            return proposed_version

        version = None
        while version is None:
            user_input = input(f"Input version to use [{proposed_version}]: ")
            if user_input:
                try:
                    version = VersionInfo.parse(user_input)
                except ValueError as exc:
                    print(exc)
                    continue
            else:
                version = proposed_version

        return version
コード例 #5
0
    def post_stac_search(cls, provider_json, data):
        """POST /stac/search"""

        logging.info(f'StacComposeServices.post_stac_search - provider_json: {provider_json}')

        # default: STAC >= 0.9.0
        base_url = '{}/search'.format(provider_json['url'])

        if VersionInfo.parse(provider_json['version']) <= VersionInfo.parse('0.7.0'):
            base_url = '{}/stac/search'.format(provider_json['url'])

        logging.info(f"StacComposeServices.post_stac_search - base_url: 'POST {base_url}\'")

        response = post(
            base_url,
            headers={'Content-Type': 'application/json'},
            data=dumps(data)
        )

        logging.info(f"StacComposeServices.post_stac_search - response: {response}")

        if response and response.status_code in (200, 201):
            return loads(response.text)

        return {'status_code': response.status_code, 'description': response.text}
コード例 #6
0
ファイル: business.py プロジェクト: inpe-cdsr/stac-compose
    def stac_post(cls,
                  provider_json,
                  url,
                  collection,
                  bbox,
                  datetime=False,
                  cloud_cover=None,
                  page=1,
                  limit=100):
        logging.info('CollectionsBusiness.stac_post')

        logging.info('CollectionsBusiness.stac_post - provider_json: %s',
                     provider_json)
        logging.info('CollectionsBusiness.stac_post - url: %s', url)
        logging.info('CollectionsBusiness.stac_post - collection: %s',
                     collection)
        logging.info('CollectionsBusiness.stac_post - bbox: %s', bbox)
        logging.info('CollectionsBusiness.stac_post - datetime: %s', datetime)
        logging.info('CollectionsBusiness.stac_post - cloud_cover: %s',
                     cloud_cover)
        logging.info('CollectionsBusiness.stac_post - page: %s', page)
        logging.info('CollectionsBusiness.stac_post - limit: %s', limit)

        data = {
            'bbox': bbox.split(','),
            'query': {
                'collection': {
                    'eq': collection
                }
            },
            'page': page,
            'limit': limit
        }

        # if cloud_cover is a number and not a boolean
        if isinstance(cloud_cover,
                      (int, float)) and not isinstance(cloud_cover, bool):
            data['query']['eo:cloud_cover'] = {'lte': cloud_cover}

        # if STAC <= '0.7.0'
        if datetime and (VersionInfo.parse(provider_json['version']) <=
                         VersionInfo.parse('0.7.0')):
            data['time'] = datetime
        elif datetime:
            # default: STAC >= 0.9.0
            data['datetime'] = datetime

        logging.info('CollectionsBusiness.stac_post - data: %s', data)

        try:
            response = StacComposeServices.post_stac_search(
                provider_json, data)
            return response
        except Exception as error:
            # logging.debug(f'CollectionsBusiness.stac_post - error: \n{error}', error)
            return None
コード例 #7
0
    def get_stac_search(cls, provider_json, collection, bbox, datetime, query=None, page=1, limit=MAX_LIMIT):
        """GET /stac/search"""

        logging.info('StacBusiness.get_stac_search\n')

        logging.info('StacBusiness.get_stac_search - provider_json: %s', provider_json)
        logging.info('StacBusiness.get_stac_search - collection: %s', collection)
        logging.info('StacBusiness.get_stac_search - bbox: %s', bbox)
        logging.info('StacBusiness.get_stac_search - datetime: %s', datetime)
        logging.info('StacBusiness.get_stac_search - query: %s', query)
        logging.info('StacBusiness.post_stac_sget_stac_searchearch() - page: %s', page)
        logging.info('StacBusiness.get_stac_search - limit: %s', limit)

        search_collection_as_property = provider_json['search_collection_as_property']

        logging.info('StacBusiness.get_stac_search - url: %s', provider_json['url'])
        logging.info('StacBusiness.get_stac_search - search_collection_as_property: %s\n', search_collection_as_property)

        parameters = []

        if isinstance(bbox, str):
            parameters.append('bbox={}'.format(bbox))
        elif isinstance(bbox, list):
            bbox = ",".join(list(map(str, bbox)))
            parameters.append('bbox={}'.format(bbox))
        else:
            raise BadRequest('`bbox` field is invalid: `{0}`, it should be a string or list, but its type is {1}.'.format(bbox, type(bbox)))

        parameters.append('collections={}'.format(collection))

        # if STAC <= '0.7.0'
        if datetime and (VersionInfo.parse(provider_json['version']) <= VersionInfo.parse('0.7.0')):
            parameters.append('time={}'.format(datetime))
        elif datetime:
            # default: STAC >= 0.9.0
            parameters.append('datetime={}'.format(datetime))

        # if cloud_cover:
        #     query += '&eo:cloud_cover=0/{}'.format(cloud_cover)

        parameters.append('page={}'.format(page))
        parameters.append('limit={}'.format(limit))

        parameters = "&".join(parameters)

        logging.info('StacBusiness.get_stac_search - parameters: %s', parameters)

        response = StacComposeServices.get_stac_search(provider_json, parameters)

        # post processing to add field and rename other ones if it is necessary
        response = add_context_field_in_the_feature_collection_if_it_does_not_exist(response, page=page, limit=limit)
        response = rename_fields_from_feature_collection(response)

        # logging.info('StacBusiness.get_stac_search - response: %s', response)

        return response
コード例 #8
0
def is_plugin_updated(plugin_name):
    try:
        old_version = VersionInfo.parse(
            normalize_version_to_semver(
                config["PLUGIN_VERSIONS"][plugin_name]))
        new_version = VersionInfo.parse(
            normalize_version_to_semver(_get_plugin_version(plugin_name)))
        return new_version != old_version
    except KeyError:
        # We have no previous record of this plugin, so it is updated
        return True
コード例 #9
0
ファイル: pipelines.py プロジェクト: Fourcast/flycs_sdk
def _is_valid_version(version: str) -> bool:
    """Test if version is using a valid semver format.

    :param version: version to validate
    :type version: str
    :raises: ValueError
    :return: true if version has a valid format
    :rtype: bool
    """
    VersionInfo.parse(version)
    return True
コード例 #10
0
 def gte(self, version, target):
     """ Returns True if the SemVer version >= target
         and otherwise False including if an exception is thrown """
     try:
         version = VersionInfo.parse(version)
         target = VersionInfo.parse(target)
         # version=tuple(version.translate(str.maketrans('', '', string.punctuation)))
         # target=tuple(target.translate(str.maketrans('', '', string.punctuation)))
         return version >= target
     except ValueError:
         # Returning False on exception as a workaround for when an null (or invalid) semver version is passed
         return False
コード例 #11
0
def test_versions(tmp_path: Path) -> None:
    """Check that all modified charts have an updated version number.

    For automatic publication of new Helm charts to work, we have to remember
    to update the version number of a chart whenever we make changes to it.
    This test verifies that by verifying there have been no Git commits that
    change the contents of a chart since the last tagged release if the
    version of the chart matches the last released version.

    This check is done with Git rather than by comparing the contents of the
    package since helm package makes changes to files when packaging (such as
    canonicalizing Chart.yaml).
    """
    root_path = Path(__file__).parent.parent
    charts_path = root_path / "charts"
    repo = Repo(str(root_path))

    r = requests.get(REPOSITORY_URL)
    assert r.status_code == requests.codes.ok
    index = yaml.safe_load(r.text)

    # Only check charts that have been published.
    published_charts = set(index["entries"].keys())
    current_charts = set((p.name for p in charts_path.iterdir()))
    charts_to_check = published_charts & current_charts

    errors = []
    for chart in charts_to_check:
        published = max(index["entries"][chart],
                        key=lambda e: VersionInfo.parse(e["version"]))

        # If the version number in the current repository is later than the
        # latest published version, differences are allowed.
        with (charts_path / chart / "Chart.yaml").open() as f:
            metadata = yaml.safe_load(f)
            current = VersionInfo.parse(metadata["version"])
            latest = VersionInfo.parse(published["version"])
            if current > latest:
                continue

        # Otherwise, construct the tag of the previous release and look for
        # any changes in Git since that release.
        tag = f"{chart}-{published['version']}"
        if not any((t.name == tag for t in repo.tags)):
            continue
        diff = repo.head.commit.diff(tag, paths=[f"charts/{chart}"])
        for change_type in DiffIndex.change_type:
            if any(diff.iter_change_type(change_type)):
                msg = f"Chart {chart} has changed but has same version"
                errors.append(msg)
                break

    assert "" == "\n".join(errors)
コード例 #12
0
def test_tags_returns_ordered_newest_first() -> None:
    with patch("materialize.spawn.capture") as mock:
        # NOTE(benesch): we mock out the return value of `git tag` because local
        # Git clones are missing tags weirdly often. I'm not sure why.
        # Regardless, it's better for unit tests not to depend on the local Git
        # repository state.
        mock.return_value = """0.2.0
0.3.2-rc1
0.3.1"""
        tags = git.get_version_tags(fetch=False)
    assert tags == [
        VersionInfo.parse("0.3.2-rc1"),
        VersionInfo.parse("0.3.1"),
        VersionInfo.parse("0.2.0"),
    ]
コード例 #13
0
ファイル: circup.py プロジェクト: hugodahl/circup
    def outofdate(self):
        """
        Returns a boolean to indicate if this module is out of date.

        :return: Truthy indication if the module is out of date.
        """
        if self.device_version and self.bundle_version:
            try:
                return VersionInfo.parse(self.device_version) < VersionInfo.parse(
                    self.bundle_version
                )
            except ValueError as ex:
                logger.warning("Module '%s' has incorrect semver value.", self.name)
                logger.warning(ex)
        return True  # Assume out of date to try to update.
コード例 #14
0
    def _get_upgrade_tests_commands(release_name: str, previous_list: List[str]):
        previous_list = sorted(previous_list, key=functools.cmp_to_key(semver.compare), reverse=True)
        versions_by_minor: OrderedDict = OrderedDict()
        for version_str in previous_list:
            version = VersionInfo.parse(version_str)
            minor_version = f"{version.major}.{version.minor}"
            versions_by_minor.setdefault(minor_version, []).append(str(version))

        test_edges = []
        for _, versions in versions_by_minor.items():
            if len(versions) <= 15:
                test_edges.extend(versions)
                continue
            test_edges.extend(versions[:5])  # add first 5
            # 5 equally distributed between versions[5:-5]
            step = (len(versions) - 10) // 5
            test_edges.extend(versions[5:-5][step::step])
            test_edges.extend(versions[-5:])  # add last 5

        test_commands = []
        platforms = ['aws', 'gcp', 'azure']
        for edge in test_edges:
            platform = platforms[len(test_commands) % len(platforms)]
            test_commands.append(f"test upgrade {edge} {release_name} {platform}")
        return test_commands
コード例 #15
0
def version_from_version_path(version_path, log_file):
    try:
        return VersionInfo.parse(os.path.basename(version_path))
    except ValueError:
        if log_file:
            log_file.write("  Invalid version detected [{0}]\n".format(version_path))
        return None
コード例 #16
0
ファイル: semver.py プロジェクト: NowanIlfideme/pydantic-yaml
 def validate(cls, value: Union[str, "SemVer"]) -> "SemVer":
     vi = VersionInfo.parse(value)
     if not cls.allow_build and (vi.build is None):
         raise errors.NotNoneError()
     if not cls.allow_prerelease and (vi.prerelease is None):
         raise errors.NotNoneError()
     return cls(value)
コード例 #17
0
ファイル: publish.py プロジェクト: fonsp/TagBot
def current_version() -> VersionInfo:
    with open(repo_file("pyproject.toml")) as f:
        pyproject = f.read()
    m = re.search(r'version = "(.*)"', pyproject)
    if not m:
        raise ValueError("Invalid pyproject.toml")
    return VersionInfo.parse(m[1])
コード例 #18
0
 def _parse_connection_resp(self, data):
     if len(data) < 4:
         raise Exception(
             'BlueSky host did not provide a version - please upgrade to at least '
             '1.0.4')
     self.host_id = data[0]
     self.host_version = VersionInfo.parse(data[1].decode())
コード例 #19
0
ファイル: test_server.py プロジェクト: jsimet/kedro-viz
def test_viz_kedro14_pipeline_flag(mocker, cli_runner):
    """Test that running viz with `--pipeline` flag in Kedro 0.14.0 is not supported."""
    mocker.patch("kedro_viz.server.KEDRO_VERSION", VersionInfo.parse("0.14.0"))

    def create_catalog(config):  # pylint: disable=unused-argument,bad-continuation
        return lambda x: None

    def get_config(
        project_path: str,
        env: str = None  # pylint: disable=bad-continuation
    ):  # pylint: disable=unused-argument
        return "config"

    def get_project_context(key: str):
        return {
            "create_pipeline": create_pipeline,
            "create_catalog": create_catalog,
            "get_config": get_config,
        }[key]

    mocker.patch("kedro_viz.server.get_project_context",
                 new=get_project_context)
    result = cli_runner.invoke(server.commands,
                               ["viz", "--pipeline", "another"])
    assert "`--pipeline` flag was provided" in result.output
コード例 #20
0
ファイル: version.py プロジェクト: jamesabel/pyshipupdate
def version_from_clip_zip(target_app_name: str,
                          candidate_clip_zip: str) -> Union[VersionInfo, None]:
    """
    Tests if a string is a clip zip string.  If so, extract the version from a clip zip string.  If the string is not a valid clip zip string, return None.
    Example: a clip zip string of "abc_1.2.3.zip" for app "abc" returns VersionInfo of 1.2.3.
    :param target_app_name: target app name
    :param candidate_clip_zip: candidate clip app zip string to try to get the version from
    :return: version or None if not a successful parse for a clip zip string
    """
    version = None
    extension = f".{CLIP_EXT}"
    if candidate_clip_zip.startswith(target_app_name):
        version_string = candidate_clip_zip[len(target_app_name):]
        if version is None and version_string.endswith(extension):
            version_string = version_string[:-len(
                extension)]  # remove extension
            if version_string.startswith("_"):
                try:
                    version = VersionInfo.parse(
                        version_string[1:])  # pass over the "_"
                except IndexError as e:
                    log.debug(e)
                except TypeError as e:
                    log.debug(e)
                except ValueError as e:
                    log.debug(e)
    return version
コード例 #21
0
def parse_component_identifier(name: str, use_default_version: bool = False) \
        -> 'Tuple[str, Optional[VersionInfo]]':
    """
    Turn a string that looks like ``component`` or ``component:version`` into a tuple of component
    name and/or semver, optionally filling in the version value from the default taken from the
    manifest.

    :param name:
        The string that identifies the component, in the form ``component[:version]``.
    :param use_default_version:
        ``True`` to look in dazl's artifact manifest for a suggested version if none is supplied;
        otherwise, ``False`` to simply return ``None`` for version information.
    :return:
        A tuple of component name and optional version.
    :raise ValueError:
        ``name`` is not a valid component string

    >>> parse_component_identifier('sandbox')
    ('sandbox', None)
    >>> parse_component_identifier('sandbox:6.0.0')
    ('sandbox', VersionInfo(major=6, minor=0, patch=0, prerelease=None, build=None))
    """
    if name is None:
        raise ValueError('name is required')

    component, _, version = name.partition(':')
    if not component:
        raise ValueError('component name must be specified')

    parsed_version = VersionInfo.parse(version) if version else None
    if parsed_version is None:
        if use_default_version:
            parsed_version = load_artifacts().artifacts[component].default_version

    return component, parsed_version
コード例 #22
0
ファイル: main.py プロジェクト: vector-of-bool/dds-ports
def check_sdist(pid: PackageID, dirpath: Path) -> None:
    cand_files = ('package.json', 'package.json5', 'package.jsonc')
    candidates = (dirpath / fname for fname in cand_files)
    found = [c for c in candidates if c.is_file()]
    if not found:
        raise RuntimeError(
            f'Port for {pid} did not produce a package JSON manifest file')

    content = json5.loads(found[0].read_text())
    if not isinstance(
            content,
            dict) or not 'name' in content or not 'version' in content:
        raise RuntimeError(
            f'Package manifest for {pid} is invalid (Got: {content})')
    try:
        manver = VersionInfo.parse(content['version'])
    except ValueError as e:
        raise RuntimeError(
            f'"version" for {pid} is not a valid semantic version (Got {content["version"]})'
        ) from e
    if content['name'] != pid.name:
        raise RuntimeError(
            f'Package manifest for {pid} declares different name "{content["name"]}'
        )
    if manver != pid.version:
        raise RuntimeError(
            f'Package manifest for {pid} declares a different version [{manver}]'
        )

    if not dirpath.joinpath('src').is_dir() and not dirpath.joinpath(
            'include').is_dir():
        raise RuntimeError(
            f'Package {pid} does not contain either a src/ or include/ directory'
        )
    print(f'Package {pid} is OK')
コード例 #23
0
ファイル: __init__.py プロジェクト: hylkepostma/metadater
 def _init_metadata_from_json(self):
     _path = Path(self._full_repo_path) / "metadata.json"
     with _path.open() as _f:
         _metadata = json.load(_f)
         self.metadata = MetaData(_metadata)
         self.metadata.version_info = VersionInfo.parse(
             self.metadata.semver)
コード例 #24
0
def test_get_available_versions(updater_fixture):

    buckets = updater_fixture.bucket_list()
    print(f"{buckets=}")
    available_versions = updater_fixture.get_available_versions()
    print(available_versions)
    assert VersionInfo.parse("0.0.1") in available_versions
コード例 #25
0
    def major_update(self):
        """
        Returns a boolean to indicate if this is a major version update.

        :return: Boolean indicating if this is a major version upgrade
        """
        try:
            if (VersionInfo.parse(
                    self.device_version).major == VersionInfo.parse(
                        self.bundle_version).major):
                return False
        except TypeError as ex:
            logger.warning("Module '%s' has incorrect semver value.",
                           self.name)
            logger.warning(ex)
        return True  # Assume Major Version udpate.
コード例 #26
0
    def __init__(self):
        coloredlogs.install(level='INFO', fmt="%(message)s")
        #        logging.basicConfig(format="%(message)s",level=logging.INFO,stream=sys.stdout)
        #        logger = logging.getLogger()
        #        logger.setLevel("INFO")
        logging.info("\nVersion in Progress = %s" % version_in_progress)

        self.vip = version_in_progress

        self.buildConfig = None
        self.parentCompiler = None
        self.parentMPI = None
        self.dryRun = True
        self.buildsToCancel = []

        # parse version to derive obs-specific version info
        vparse = VersionInfo.parse(self.vip)
        self.branchVer = str(vparse.major) + '.' + str(vparse.minor)
        self.microVer = str(vparse.patch)

        logging.info("--> Branch version  = %s" % self.branchVer)
        logging.info("--> Micro release   = %s" % self.microVer)

        self.obsProject = "OpenHPC:" + self.branchVer + ":Update" + self.microVer + ":Factory"
        logging.info("--> OBS project     = %s" % self.obsProject)
コード例 #27
0
ファイル: _local_workspace.py プロジェクト: jaxxstorm/pulumi
def _parse_and_validate_pulumi_version(min_version: VersionInfo,
                                       current_version: str,
                                       opt_out: bool) -> Optional[VersionInfo]:
    """
    Parse and return a version. An error is raised if the version is not
    valid. If *current_version* is not a valid version but *opt_out* is true,
    *None* is returned.
    """
    try:
        version: Optional[VersionInfo] = VersionInfo.parse(current_version)
    except ValueError:
        version = None
    if opt_out:
        return version
    if version is None:
        raise InvalidVersionError(
            f"Could not parse the Pulumi CLI version. This is probably an internal error. "
            f"If you are sure you have the correct version, set {_SKIP_VERSION_CHECK_VAR}=true."
        )
    if min_version.major < version.major:
        raise InvalidVersionError(
            f"Major version mismatch. You are using Pulumi CLI version {version} with "
            f"Automation SDK v{min_version.major}. Please update the SDK.")
    if min_version.compare(version) == 1:
        raise InvalidVersionError(
            f"Minimum version requirement failed. The minimum CLI version requirement is "
            f"{min_version}, your current CLI version is {version}. "
            f"Please update the Pulumi CLI.")
    return version
コード例 #28
0
ファイル: test_server.py プロジェクト: jsimet/kedro-viz
def test_viz_kedro14_invalid(mocker, cli_runner):
    """Test that running viz in Kedro 0.14.0,
    while outside of a Kedro project is not supported."""
    mocker.patch("kedro_viz.server.KEDRO_VERSION", VersionInfo.parse("0.14.0"))
    mocker.patch("kedro_viz.server.get_project_context", side_effect=KeyError)
    result = cli_runner.invoke(server.commands, "viz")
    assert "Could not find a Kedro project root." in result.output
コード例 #29
0
async def all_ports() -> port.PortIter:
    tags_ver_strs = (
        ('v1.2.11', '1.2.11'),
        ('v1.2.10', '1.2.10'),
        ('v1.2.9', '1.2.9'),
        ('v1.2.8', '1.2.8'),
        ('v1.2.7.3', '1.2.7'),
        ('v1.2.6.1', '1.2.6'),
        ('v1.2.5.3', '1.2.5'),
        ('v1.2.4.5', '1.2.4'),
        ('v1.2.3.8', '1.2.3'),
        ('v1.2.2.4', '1.2.2'),
        ('v1.2.1.2', '1.2.1'),
        ('v1.2.0.8', '1.2.0'),
    )

    tags_vers = ((tag, VersionInfo.parse(s)) for tag, s in tags_ver_strs)

    return (auto.SimpleGitHubAdaptingPort(
        package_id=port.PackageID('zlib', version),
        owner='madler',
        repo='zlib',
        tag=tag,
        package_json={
            'name': 'zlib',
            'namespace': 'zlib',
            'depends': [],
        },
        library_json={
            'name': 'zlib',
            'uses': [],
        },
        fs_transform=fixup_zlib,
        try_build=True,
    ) for tag, version in tags_vers)
コード例 #30
0
ファイル: test_stage_condition.py プロジェクト: meseta/lgtm
class TestQuestBranching(Quest):
    class QuestDataModel(QuestBaseModel):
        value_a: int = 1
        value_b: int = 2

    version = VersionInfo.parse("1.0.0")
    difficulty = Difficulty.RESERVED
    description = "This is a quest to test branching"

    class Start(DebugStage):
        children = ["BranchA", "BranchB"]

    class BranchA(ConditionStage):
        children = ["EndingA"]
        variable = "value_a"
        compare_variable = "value_b"

    class BranchB(ConditionStage):
        children = ["EndingB"]
        variable = "value_a"
        operator = operator.gt
        compare_value = 10

    class EndingA(FinalStage):
        children = []

    class EndingB(FinalStage):
        children = []
コード例 #31
0
ファイル: test_semver.py プロジェクト: k-bx/python-semver
def test_parse_method_for_version_info():
    s_version = "1.2.3-alpha.1.2+build.11.e0f985a"
    v = VersionInfo.parse(s_version)
    assert str(v) == s_version