Skip to content

Commit 9b069b7

Browse files
committed
Initial commit
0 parents  commit 9b069b7

File tree

14 files changed

+268
-0
lines changed

14 files changed

+268
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = tab
6+
indent_size = 4
7+
insert_final_newline = true
8+
end_of_line = lf
9+
10+
[*.{yml,yaml}]
11+
indent_style = space
12+
indent_size = 2

.github/.templateMarker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
KOLANICH/python_project_boilerplate.py

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
allow:
8+
- dependency-type: "all"

.github/workflows/CI.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: typical python workflow
13+
uses: KOLANICH-GHActions/typical-python-workflow@master
14+
with:
15+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
/*.egg-info
5+
/build
6+
/dist
7+
/.eggs
8+
*.sqlite3
9+
*.sqlite
10+
/.mypy_cache
11+
*.py,cover
12+
/.coverage
13+
/rspec.xml
14+
/monkeytype.sqlite3
15+
/*.srctrldb
16+
/*.srctrlbm
17+
/*.srctrlprj

.gitlab-ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#image: pypy:latest
2+
image: registry.gitlab.com/kolanich-subgroups/docker-images/fixed_python:latest
3+
stages:
4+
- dependencies
5+
- build
6+
- test
7+
- trigger
8+
9+
variables:
10+
DOCKER_DRIVER: overlay2
11+
SAST_ANALYZER_IMAGE_TAG: latest
12+
SAST_DISABLE_DIND: "true"
13+
14+
include:
15+
- template: SAST.gitlab-ci.yml
16+
#- template: DAST.gitlab-ci.yml
17+
#- template: License-Management.gitlab-ci.yml
18+
#- template: Container-Scanning.gitlab-ci.yml
19+
#- template: Dependency-Scanning.gitlab-ci.yml
20+
- template: Code-Quality.gitlab-ci.yml
21+
22+
23+
build:
24+
tags:
25+
- shared
26+
stage: build
27+
variables:
28+
GIT_DEPTH: "1"
29+
PYTHONUSERBASE: ${CI_PROJECT_DIR}/python_user_packages
30+
31+
before_script:
32+
- export PYTHON_MODULES_DIR=${PYTHONUSERBASE}/lib/python3.7
33+
- export EXECUTABLE_DEPENDENCIES_DIR=${PYTHONUSERBASE}/bin
34+
- export PATH="$PATH:$EXECUTABLE_DEPENDENCIES_DIR" # don't move into `variables` any of them, it is unordered
35+
- mkdir ./wheels
36+
- pip install --upgrade --pre --user git+https://gitlab.com/KOLANICH/AnyVer.py.git
37+
38+
script:
39+
- python3 ./setup.py bdist_wheel
40+
- mv ./dist/*.whl ./wheels/TargetTriple-0.CI_python-py3-none-any.whl
41+
- pip3 install --upgrade --pre --user ./wheels/TargetTriple-0.CI_python-py3-none-any.whl
42+
- coverage run --source=TargetTriple --branch -m pytest --junitxml=./rspec.xml ./tests/tests.py
43+
- coverage report -m
44+
- coverage xml
45+
46+
coverage: /^TOTAL\\s+.+?(\\d{1,3}%)$/
47+
48+
cache:
49+
paths:
50+
- $PYTHONUSERBASE
51+
52+
artifacts:
53+
paths:
54+
- wheels
55+
reports:
56+
junit: ./rspec.xml
57+
cobertura: ./coverage.xml
58+

Code_Of_Conduct.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No codes of conduct!

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include UNLICENSE
2+
include *.md
3+
include tests
4+
include .editorconfig

ReadMe.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
TargetTriple.py [![Unlicensed work](https://raw.githubusercontent.com/unlicense/unlicense.org/master/static/favicon.png)](https://unlicense.org/)
2+
===============
3+
[![GitLab Build Status](https://gitlab.com/KOLANICH/TargetTriple.py/badges/master/pipeline.svg)](https://gitlab.com/KOLANICH/TargetTriple.py/pipelines/master/latest)
4+
![GitLab Coverage](https://gitlab.com/KOLANICH/TargetTriple.py/badges/master/coverage.svg)
5+
[![Libraries.io Status](https://img.shields.io/librariesio/github/KOLANICH/TargetTriple.py.svg)](https://libraries.io/github/KOLANICH/TargetTriple.py)
6+
[![Code style: antiflash](https://img.shields.io/badge/code%20style-antiflash-FFF.svg)](https://github.com/KOLANICH-tools/antiflash.py)
7+
8+
Just represents a target triple.
9+

TargetTriple/__init__.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
__all__ = ("TargetTriple", "pythonTriple")
2+
import sys
3+
import typing
4+
5+
6+
class TargetTripleParser:
7+
__slots__ = ("archs", "oses", "abis")
8+
9+
def __init__(self, archs: typing.Set[str], oses: typing.Set[str], abis: typing.Set[str]):
10+
self.archs = archs
11+
self.oses = oses
12+
self.abis = abis
13+
14+
15+
class _TargetTriple:
16+
__slots__ = ("arch", "bitness", "os", "abi")
17+
18+
def __init__(self, arch: typing.Optional[str] = None, os: typing.Optional[str] = None, abi: typing.Optional[str] = None, bitness: typing.Optional[int] = None) -> None:
19+
self.arch = arch
20+
self.os = os
21+
self.abi = abi
22+
self.bitness = bitness
23+
24+
@classmethod
25+
def parse(cls, s: str, parser: TargetTripleParser) -> "_TargetTriple":
26+
27+
return cls()
28+
29+
def getTuple(self) -> typing.Tuple[str, str, str]:
30+
return (self.arch, self.os, self.abi)
31+
32+
def __str__(self) -> str:
33+
return "-".join(self.getTuple())
34+
35+
def __repr__(self) -> str:
36+
return self.__class__.__name__ + "(" + ", ".join(repr(c) for c in self.getTuple()) + ")"
37+
38+
def __hash__(self) -> int:
39+
return hash(self.getTuple())
40+
41+
def __eq__(self, other: "_TargetTriple") -> bool:
42+
if isinstance(other, str):
43+
return other == str(self)
44+
else:
45+
return self.getTuple() == other.getTuple()
46+
47+
48+
pythonTriple = sys.implementation._multiarch.split("-")
49+
pythonTriple = _TargetTriple(pythonTriple[0], pythonTriple[1], pythonTriple[2])
50+
51+
52+
class TargetTriple(_TargetTriple):
53+
__slots__ = ()
54+
55+
def __init__(self, arch: typing.Optional[str] = None, os: typing.Optional[str] = None, abi: typing.Optional[str] = None, bitness: typing.Optional[int] = None) -> None:
56+
arch = arch if arch is not None else pythonTriple.arch
57+
os = os if os is not None else pythonTriple.os
58+
abi = abi if abi is not None else pythonTriple.abi
59+
bitness = bitness if bitness is not None else pythonTriple.bitness
60+
super().__init__(arch, os, abi, bitness)

0 commit comments

Comments
 (0)