pyprocessors-standoff2inline 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyprocessors_standoff2inline-0.5.2/.gitignore +133 -0
- pyprocessors_standoff2inline-0.5.2/AUTHORS.md +5 -0
- pyprocessors_standoff2inline-0.5.2/CHANGELOG.md +7 -0
- pyprocessors_standoff2inline-0.5.2/Dockerfile +20 -0
- pyprocessors_standoff2inline-0.5.2/Jenkinsfile +408 -0
- pyprocessors_standoff2inline-0.5.2/LICENSE +21 -0
- pyprocessors_standoff2inline-0.5.2/PKG-INFO +94 -0
- pyprocessors_standoff2inline-0.5.2/README.md +48 -0
- pyprocessors_standoff2inline-0.5.2/RELEASE.md +39 -0
- pyprocessors_standoff2inline-0.5.2/bumpversion.py +41 -0
- pyprocessors_standoff2inline-0.5.2/docs/.gitignore +2 -0
- pyprocessors_standoff2inline-0.5.2/docs/CHANGELOG.md +7 -0
- pyprocessors_standoff2inline-0.5.2/docs/LICENSE +21 -0
- pyprocessors_standoff2inline-0.5.2/docs/_static/.gitkeep +0 -0
- pyprocessors_standoff2inline-0.5.2/docs/_templates/.gitkeep +0 -0
- pyprocessors_standoff2inline-0.5.2/docs/conf.py +84 -0
- pyprocessors_standoff2inline-0.5.2/docs/index.rst +9 -0
- pyprocessors_standoff2inline-0.5.2/mypy.ini +6 -0
- pyprocessors_standoff2inline-0.5.2/pyproject.toml +87 -0
- pyprocessors_standoff2inline-0.5.2/setup.py +53 -0
- pyprocessors_standoff2inline-0.5.2/src/pyprocessors_standoff2inline/__init__.py +2 -0
- pyprocessors_standoff2inline-0.5.2/src/pyprocessors_standoff2inline/standoff2inline.py +147 -0
- pyprocessors_standoff2inline-0.5.2/src/pyprocessors_standoff2inline/standoff2inline_processor.py +332 -0
- pyprocessors_standoff2inline-0.5.2/tests/__init__.py +0 -0
- pyprocessors_standoff2inline-0.5.2/tests/data/evalLLM1.json +771 -0
- pyprocessors_standoff2inline-0.5.2/tests/test_standoff2inline.py +36 -0
- pyprocessors_standoff2inline-0.5.2/tox.ini +49 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
results.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
.python-version
|
|
87
|
+
|
|
88
|
+
# pipenv
|
|
89
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
90
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
91
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
92
|
+
# install all needed dependencies.
|
|
93
|
+
#Pipfile.lock
|
|
94
|
+
|
|
95
|
+
# celery beat schedule file
|
|
96
|
+
celerybeat-schedule
|
|
97
|
+
|
|
98
|
+
# SageMath parsed files
|
|
99
|
+
*.sage.py
|
|
100
|
+
|
|
101
|
+
# Environments
|
|
102
|
+
.env
|
|
103
|
+
.venv
|
|
104
|
+
env/
|
|
105
|
+
venv/
|
|
106
|
+
ENV/
|
|
107
|
+
env.bak/
|
|
108
|
+
venv.bak/
|
|
109
|
+
|
|
110
|
+
# Spyder project settings
|
|
111
|
+
.spyderproject
|
|
112
|
+
.spyproject
|
|
113
|
+
|
|
114
|
+
# Rope project settings
|
|
115
|
+
.ropeproject
|
|
116
|
+
|
|
117
|
+
# mkdocs documentation
|
|
118
|
+
/site
|
|
119
|
+
|
|
120
|
+
# mypy
|
|
121
|
+
.mypy_cache/
|
|
122
|
+
.dmypy.json
|
|
123
|
+
dmypy.json
|
|
124
|
+
|
|
125
|
+
# Pyre type checker
|
|
126
|
+
.pyre/
|
|
127
|
+
|
|
128
|
+
# PyCharm stuff:
|
|
129
|
+
.idea
|
|
130
|
+
|
|
131
|
+
# Specific
|
|
132
|
+
.groovylintrc.json
|
|
133
|
+
.emailNotif
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [unreleased]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM python:3.8-slim-buster
|
|
2
|
+
# Install prerequisites
|
|
3
|
+
RUN apt-get update -y && \
|
|
4
|
+
apt-get install -y \
|
|
5
|
+
patch \
|
|
6
|
+
gcc pkg-config \
|
|
7
|
+
libicu-dev && \
|
|
8
|
+
apt-get install -y --no-install-recommends \
|
|
9
|
+
g++ \
|
|
10
|
+
git && \
|
|
11
|
+
# Final upgrade + clean
|
|
12
|
+
apt-get update -y && \
|
|
13
|
+
apt-get clean all -y
|
|
14
|
+
|
|
15
|
+
# Enable Installing packages as root
|
|
16
|
+
ENV FLIT_ROOT_INSTALL=1
|
|
17
|
+
|
|
18
|
+
# Add pyproject.toml + README.md for flit install
|
|
19
|
+
ADD pyproject.toml pyproject.toml
|
|
20
|
+
ADD README.md README.md
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
pipeline {
|
|
2
|
+
environment {
|
|
3
|
+
PATH_HOME = '/home/jenkins'
|
|
4
|
+
TEST_REPORT_DIR = '/root/test-reports'
|
|
5
|
+
PYTHONPYCACHEPREFIX = '/tmp/.pytest_cache'
|
|
6
|
+
PYTHONDONTWRITEBYTECODE = '1'
|
|
7
|
+
JENKINS_UIDGID = '1004:1004'
|
|
8
|
+
|
|
9
|
+
MAJOR_VERSION = '0'
|
|
10
|
+
MINOR_VERSION = '5'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
agent none
|
|
14
|
+
|
|
15
|
+
triggers {
|
|
16
|
+
upstream(upstreamProjects: 'pymultirole_plugins/' + BRANCH_NAME.replaceAll('/', '%2F'),\
|
|
17
|
+
threshold: hudson.model.Result.SUCCESS)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
stages {
|
|
21
|
+
stage('Catch build termination') {
|
|
22
|
+
agent {
|
|
23
|
+
node {
|
|
24
|
+
label 'built-in'
|
|
25
|
+
customWorkspace "${PATH_HOME}/${JOB_NAME}"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
stages {
|
|
29
|
+
stage('Analyse build cause') {
|
|
30
|
+
steps {
|
|
31
|
+
script {
|
|
32
|
+
analyseBuildCause()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
stage('Generate new version') {
|
|
40
|
+
when {
|
|
41
|
+
environment name: 'SKIP_JOB', value: '0'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
agent {
|
|
45
|
+
node {
|
|
46
|
+
label 'built-in'
|
|
47
|
+
customWorkspace "${PATH_HOME}/${JOB_NAME}"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
stages {
|
|
52
|
+
stage('Add credentials') {
|
|
53
|
+
steps {
|
|
54
|
+
script {
|
|
55
|
+
// Add password file for flit publishing
|
|
56
|
+
sh "cp ${PATH_HOME}/.passwd-pypi .env"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
stage('Commit new version') {
|
|
62
|
+
steps {
|
|
63
|
+
script {
|
|
64
|
+
println("attempt to publish ${JOB_NAME} with version: ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_ID}")
|
|
65
|
+
|
|
66
|
+
// push updates of file __init__.py
|
|
67
|
+
withCredentials([gitUsernamePassword(credentialsId: 'bitbucket-user', gitToolName: 'git-tool')]) {
|
|
68
|
+
sh 'git pull'
|
|
69
|
+
sh "echo '\"\"\"Sherpa transform annotations to categories processor\"\"\"' > src/pyprocessors_standoff2inline/__init__.py"
|
|
70
|
+
sh "echo '__version__ = \"${MAJOR_VERSION}.${MINOR_VERSION}.${env.BUILD_ID}\"' >> src/pyprocessors_standoff2inline/__init__.py"
|
|
71
|
+
sh 'git commit src/pyprocessors_standoff2inline/__init__.py -m "[Jenkins CI] Commit on version files" || echo "No changes to commit"'
|
|
72
|
+
sh 'git push'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
stage('Build, test and publish') {
|
|
81
|
+
when {
|
|
82
|
+
beforeAgent true
|
|
83
|
+
environment name: 'SKIP_JOB', value: '0'
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
agent {
|
|
87
|
+
// dockerfile agent
|
|
88
|
+
// Mounted volume for Junit reports
|
|
89
|
+
// - docker: /root/test-reports
|
|
90
|
+
// - host : /tmp/_${JOB_NAME}/test-reports
|
|
91
|
+
dockerfile {
|
|
92
|
+
label 'built-in'
|
|
93
|
+
customWorkspace "${PATH_HOME}/${JOB_NAME}"
|
|
94
|
+
filename 'Dockerfile'
|
|
95
|
+
args "-u root --privileged -v /tmp/_${JOB_NAME}/test-reports:${TEST_REPORT_DIR}"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
stages {
|
|
100
|
+
stage('Install flit & flake8') {
|
|
101
|
+
steps {
|
|
102
|
+
// remove any previous tox env
|
|
103
|
+
sh 'rm -rf .tox'
|
|
104
|
+
sh 'python -m pip install pip==22.0.3'
|
|
105
|
+
sh 'pip install --no-cache-dir flit==3.2.0 flake8==3.9.2 flakehell tox'
|
|
106
|
+
sh 'flit install'
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
stage('Test & lint python code') {
|
|
111
|
+
steps {
|
|
112
|
+
// remove any previous results.xml file
|
|
113
|
+
sh "rm -f ${TEST_REPORT_DIR}/results.xml"
|
|
114
|
+
sh 'tox'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
stage('Publish on PyPI') {
|
|
119
|
+
environment {
|
|
120
|
+
FLIT_USERNAME = getUserName '.env'
|
|
121
|
+
FLIT_PASSWORD = getUserPass '.env'
|
|
122
|
+
}
|
|
123
|
+
steps {
|
|
124
|
+
// remove any previous folder dist
|
|
125
|
+
sh 'rm -rf dist'
|
|
126
|
+
// create (as root) folder dist
|
|
127
|
+
sh 'mkdir dist'
|
|
128
|
+
// pull recent updates of file __init__.py
|
|
129
|
+
withCredentials([gitUsernamePassword(credentialsId: 'bitbucket-user', gitToolName: 'git-tool')]) {
|
|
130
|
+
sh 'git config --global pull.rebase false'
|
|
131
|
+
sh "git config --global --add safe.directory ${WORKSPACE}"
|
|
132
|
+
sh 'git pull'
|
|
133
|
+
}
|
|
134
|
+
// put back owner of .git folder
|
|
135
|
+
sh "chown -R ${JENKINS_UIDGID} ${WORKSPACE}/.git"
|
|
136
|
+
// put back owner of pulled file
|
|
137
|
+
sh "chown ${JENKINS_UIDGID} src/pyprocessors_standoff2inline/__init__.py"
|
|
138
|
+
// get git status
|
|
139
|
+
sh 'git status'
|
|
140
|
+
// publish on PyPI
|
|
141
|
+
sh '''
|
|
142
|
+
export COMMIT_VERSION=$( cat src/pyprocessors_standoff2inline/__init__.py|grep version|cut -d '"' -f2|tr -s '[:blank:]' )
|
|
143
|
+
export BUILD_VERSION="${MAJOR_VERSION}"."${MINOR_VERSION}"."${BUILD_ID}"
|
|
144
|
+
if [ "${COMMIT_VERSION}" = "${BUILD_VERSION}" ] ; then flit publish ; fi
|
|
145
|
+
'''
|
|
146
|
+
// remove current folder dist
|
|
147
|
+
sh 'rm -rf dist'
|
|
148
|
+
// remove current folder .hypothesis
|
|
149
|
+
sh 'rm -rf .hypothesis'
|
|
150
|
+
// remove current folder .tox
|
|
151
|
+
sh 'rm -rf .tox'
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
post {
|
|
159
|
+
// only triggered when blue or green sign
|
|
160
|
+
success {
|
|
161
|
+
// node is specified here to get an agent
|
|
162
|
+
node('built-in') {
|
|
163
|
+
// keep using customWorkspace to store Junit report
|
|
164
|
+
ws("${PATH_HOME}/${JOB_NAME}") {
|
|
165
|
+
script {
|
|
166
|
+
try {
|
|
167
|
+
sh 'rm -f results.xml'
|
|
168
|
+
sh "cp /tmp/_${JOB_NAME}/test-reports/results.xml results.xml"
|
|
169
|
+
} catch (Exception e) {
|
|
170
|
+
println 'Exception occurred: ' + e.toString()
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
junit 'results.xml'
|
|
174
|
+
} catch (Exception e) {
|
|
175
|
+
println 'Exception occurred: ' + e.toString()
|
|
176
|
+
}
|
|
177
|
+
if (sendEmailNotif("${PATH_HOME}/${JOB_NAME}", "${BUILD_NUMBER}")) {
|
|
178
|
+
println 'sending Success Build notification'
|
|
179
|
+
CUSTOM_SUBJECT = '[CI - Jenkinzz SUCCESS] ' + CUSTOM_SUBJECT
|
|
180
|
+
emailext(
|
|
181
|
+
mimeType: 'text/html',
|
|
182
|
+
subject: CUSTOM_SUBJECT,
|
|
183
|
+
body: '${DEFAULT_CONTENT}',
|
|
184
|
+
replyTo: '${DEFAULT_REPLYTO}',
|
|
185
|
+
to: '${ADMIN_RECIPIENTS}' + ';' + CUSTOM_RECIPIENTS
|
|
186
|
+
)
|
|
187
|
+
switchEmailNotif(false, BUILD_NUMBER)
|
|
188
|
+
} else {
|
|
189
|
+
println 'preventing Success Build notification'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// triggered when red sign
|
|
196
|
+
failure {
|
|
197
|
+
// node is specified here to get an agent
|
|
198
|
+
node('built-in') {
|
|
199
|
+
// keep using customWorkspace to store Junit report
|
|
200
|
+
ws("${PATH_HOME}/${JOB_NAME}") {
|
|
201
|
+
script {
|
|
202
|
+
try {
|
|
203
|
+
sh 'rm -f results.xml'
|
|
204
|
+
sh "cp /tmp/_${JOB_NAME}/test-reports/results.xml results.xml"
|
|
205
|
+
} catch (Exception e) {
|
|
206
|
+
println 'Exception occurred: ' + e.toString()
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
junit 'results.xml'
|
|
210
|
+
} catch (Exception e) {
|
|
211
|
+
println 'Exception occurred: ' + e.toString()
|
|
212
|
+
}
|
|
213
|
+
println 'sending Failure Build notification'
|
|
214
|
+
CUSTOM_SUBJECT = '[CI - Jenkinzz FAILURE] ' + CUSTOM_SUBJECT
|
|
215
|
+
emailext(
|
|
216
|
+
mimeType: 'text/html',
|
|
217
|
+
subject: CUSTOM_SUBJECT,
|
|
218
|
+
body: '${DEFAULT_CONTENT}',
|
|
219
|
+
replyTo: '${DEFAULT_REPLYTO}',
|
|
220
|
+
to: '${ADMIN_RECIPIENTS}' + ';' + CUSTOM_RECIPIENTS
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// triggered when black sign
|
|
227
|
+
aborted {
|
|
228
|
+
println 'post-declarative message: abort job'
|
|
229
|
+
}
|
|
230
|
+
// trigger every-works
|
|
231
|
+
//always {
|
|
232
|
+
//}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// return FLIT_USERNAME from given file
|
|
237
|
+
def getUserName(path) {
|
|
238
|
+
USERNAME = sh(
|
|
239
|
+
script: "grep FLIT_USERNAME ${path}|cut -d '=' -f2",
|
|
240
|
+
returnStdout: true
|
|
241
|
+
).trim()
|
|
242
|
+
return USERNAME
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// return FLIT_PASSWORD from given file
|
|
246
|
+
def getUserPass(path) {
|
|
247
|
+
USERPASS = sh(
|
|
248
|
+
script: "grep FLIT_PASSWORD ${path}|cut -d '=' -f2",
|
|
249
|
+
returnStdout: true
|
|
250
|
+
).trim()
|
|
251
|
+
return USERPASS
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// create/remove emailNotif file to trigger email notification
|
|
255
|
+
def switchEmailNotif(toggle, build) {
|
|
256
|
+
if (toggle) {
|
|
257
|
+
sh 'echo ' + build + ' > .emailNotif'
|
|
258
|
+
} else {
|
|
259
|
+
if (build == BUILD_NUMBER) {
|
|
260
|
+
sh 'rm -f .emailNotif'
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// return true if emailNotif file present
|
|
266
|
+
boolean sendEmailNotif(path, build) {
|
|
267
|
+
emailNotif = sh(
|
|
268
|
+
script: "find ${path} -name '.emailNotif'|wc -l",
|
|
269
|
+
returnStdout: true
|
|
270
|
+
).trim()
|
|
271
|
+
emailContent = ''
|
|
272
|
+
if (emailNotif == '1') {
|
|
273
|
+
emailContent = sh(
|
|
274
|
+
script: "cat ${path}/.emailNotif",
|
|
275
|
+
returnStdout: true
|
|
276
|
+
).trim()
|
|
277
|
+
}
|
|
278
|
+
return (emailContent == build)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
def analyseBuildCause() {
|
|
282
|
+
upstreamProjects = ['pyimporters_plugins']
|
|
283
|
+
boolean upstreamRunning = false
|
|
284
|
+
String jobName
|
|
285
|
+
// iterate over upstreamProjects
|
|
286
|
+
for (upstream_project in upstreamProjects) {
|
|
287
|
+
Jenkins.instance.getItemByFullName(upstream_project).items.each { repository ->
|
|
288
|
+
boolean isRunning = false
|
|
289
|
+
//repository.parent.name: project
|
|
290
|
+
//repository.name: branch
|
|
291
|
+
if ( repository.name == BRANCH_NAME ) {
|
|
292
|
+
// iterate over all jobs of current repository
|
|
293
|
+
repository.allJobs.each { job ->
|
|
294
|
+
// iterate over all builds of current job
|
|
295
|
+
job.builds.each { build ->
|
|
296
|
+
// determine if a build is running or not
|
|
297
|
+
if ( build.result == (null) ) {
|
|
298
|
+
jobName = build.parent.parent.name
|
|
299
|
+
isRunning = true
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if ( isRunning ) {
|
|
303
|
+
upstreamRunning = true
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Catch if build has been triggered by CI Commit
|
|
311
|
+
// returnStatus = true when string not found -> Team commit
|
|
312
|
+
// returnStatus = false when string is found -> CI commit
|
|
313
|
+
boolean lastCommitIsTeam = sh(
|
|
314
|
+
script: 'git log -1 | grep "\\[Jenkins CI\\]"',
|
|
315
|
+
returnStatus: true
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
// Skip build when upstream detected
|
|
319
|
+
if (upstreamRunning) {
|
|
320
|
+
println 'Skipping build because upstream job detected (' + jobName + ')'
|
|
321
|
+
env.SKIP_JOB = '1'
|
|
322
|
+
switchEmailNotif(false, 0)
|
|
323
|
+
currentBuild.result = 'NOT_BUILT'
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Catch if build has been triggered by User
|
|
327
|
+
boolean isStartedByUser = currentBuild.rawBuild.getCause(hudson.model.Cause$UserIdCause) != null
|
|
328
|
+
if (isStartedByUser && !upstreamRunning) {
|
|
329
|
+
env.SKIP_JOB = '0'
|
|
330
|
+
env.CUSTOM_SUBJECT = JOB_NAME + ' - Manual Build #' + BUILD_NUMBER
|
|
331
|
+
env.CUSTOM_RECIPIENTS = emailextrecipients([[$class: 'RequesterRecipientProvider']])
|
|
332
|
+
switchEmailNotif(true, BUILD_NUMBER)
|
|
333
|
+
println 'Job started by User, proceeding'
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Catch if build has been triggered by Upstream
|
|
337
|
+
boolean isStartedByUpstream = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause) != null
|
|
338
|
+
if (isStartedByUpstream && !upstreamRunning) {
|
|
339
|
+
int changeSetCount = 0
|
|
340
|
+
int ciSkipCount = 0
|
|
341
|
+
String upstreamFullJobName = ''
|
|
342
|
+
for (Run upstreamBuild : currentBuild.upstreamBuilds) {
|
|
343
|
+
upstreamFullJobName = upstreamBuild.rawBuild.fullDisplayName
|
|
344
|
+
if (upstreamBuild.changeSets != null) {
|
|
345
|
+
def changeLogSets = upstreamBuild.changeSets
|
|
346
|
+
for (int i = 0; i < changeLogSets.size(); i++) {
|
|
347
|
+
changeSetCount++
|
|
348
|
+
def entries = changeLogSets[i].items
|
|
349
|
+
for (int j = 0; j < entries.length; j++) {
|
|
350
|
+
def entry = entries[j]
|
|
351
|
+
if (entry.msg.contains('[Jenkins CI]')) {
|
|
352
|
+
ciSkipCount++
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (changeSetCount > 0 && changeSetCount == ciSkipCount) {
|
|
359
|
+
env.SKIP_JOB = '1'
|
|
360
|
+
switchEmailNotif(false, 0)
|
|
361
|
+
println 'Job started by Upstream [' + upstreamFullJobName + '], with CI commit, skipping'
|
|
362
|
+
currentBuild.result = 'NOT_BUILT'
|
|
363
|
+
} else {
|
|
364
|
+
env.SKIP_JOB = '0'
|
|
365
|
+
env.CUSTOM_SUBJECT = JOB_NAME + ' - Upstream Build #' + BUILD_NUMBER
|
|
366
|
+
env.CUSTOM_RECIPIENTS = emailextrecipients([[$class:'UpstreamComitterRecipientProvider']])
|
|
367
|
+
switchEmailNotif(true, BUILD_NUMBER)
|
|
368
|
+
println 'Job started by Upstream [' + upstreamFullJobName + '], proceeding'
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Catch if build has been triggered by User Commit
|
|
373
|
+
boolean isStartedByCommit = currentBuild.rawBuild.getCause(jenkins.branch.BranchEventCause) != null
|
|
374
|
+
if (isStartedByCommit && lastCommitIsTeam && !upstreamRunning) {
|
|
375
|
+
env.SKIP_JOB = '0'
|
|
376
|
+
env.CUSTOM_SUBJECT = JOB_NAME + ' - SCM Build #' + BUILD_NUMBER
|
|
377
|
+
env.CUSTOM_RECIPIENTS = emailextrecipients([[$class: 'DevelopersRecipientProvider'], [$class:'CulpritsRecipientProvider']])
|
|
378
|
+
switchEmailNotif(true, BUILD_NUMBER)
|
|
379
|
+
println 'Job started by User Commit, proceeding'
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Catch if build has been triggered by cron
|
|
383
|
+
boolean isStartedByCron = currentBuild.rawBuild.getCause(hudson.triggers.TimerTrigger$TimerTriggerCause) != null
|
|
384
|
+
if (isStartedByCron && lastCommitIsTeam && !upstreamRunning) {
|
|
385
|
+
env.SKIP_JOB = '0'
|
|
386
|
+
env.CUSTOM_SUBJECT = JOB_NAME + ' - CRON Build #' + BUILD_NUMBER
|
|
387
|
+
env.CUSTOM_RECIPIENTS = emailextrecipients([[$class: 'DevelopersRecipientProvider'], [$class:'CulpritsRecipientProvider']])
|
|
388
|
+
switchEmailNotif(true, BUILD_NUMBER)
|
|
389
|
+
println 'Job started by Cron, proceeding'
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Catch if build has been triggered by branch discovery
|
|
393
|
+
boolean isStartedByBranchDiscovery = currentBuild.rawBuild.getCause(jenkins.branch.BranchIndexingCause) != null
|
|
394
|
+
if (isStartedByBranchDiscovery && lastCommitIsTeam && !upstreamRunning) {
|
|
395
|
+
env.SKIP_JOB = '0'
|
|
396
|
+
env.CUSTOM_SUBJECT = JOB_NAME + ' - BranchDiscovery Build #' + BUILD_NUMBER
|
|
397
|
+
env.CUSTOM_RECIPIENTS = emailextrecipients([[$class: 'DevelopersRecipientProvider'], [$class:'CulpritsRecipientProvider']])
|
|
398
|
+
switchEmailNotif(true, BUILD_NUMBER)
|
|
399
|
+
println 'Job started by Branch Discovery, proceeding'
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (!lastCommitIsTeam && !upstreamRunning && !isStartedByUser && !isStartedByUpstream) {
|
|
403
|
+
println 'Skipping build because last commit has been done by CI'
|
|
404
|
+
env.SKIP_JOB = '1'
|
|
405
|
+
switchEmailNotif(false, 0)
|
|
406
|
+
//currentBuild.result = 'NOT_BUILT'
|
|
407
|
+
}
|
|
408
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Olivier Terrier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyprocessors-standoff2inline
|
|
3
|
+
Version: 0.5.2
|
|
4
|
+
Summary: Sherpa transform annotations to categories processor
|
|
5
|
+
Home-page: https://github.com/oterrier/pyprocessors_standoff2inline/
|
|
6
|
+
Keywords:
|
|
7
|
+
Author: Olivier Terrier
|
|
8
|
+
Author-email: olivier.terrier@kairntech.com
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Classifier: Intended Audience :: Information Technology
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Classifier: Topic :: Software Development
|
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
+
Classifier: Development Status :: 4 - Beta
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pymultirole-plugins>=0.5.152,<0.6.0
|
|
24
|
+
Requires-Dist: collections-extended
|
|
25
|
+
Requires-Dist: Jinja2
|
|
26
|
+
Requires-Dist: log-with-context
|
|
27
|
+
Requires-Dist: flit ; extra == "dev"
|
|
28
|
+
Requires-Dist: pre-commit ; extra == "dev"
|
|
29
|
+
Requires-Dist: bump2version ; extra == "dev"
|
|
30
|
+
Requires-Dist: sphinx ; extra == "docs"
|
|
31
|
+
Requires-Dist: sphinx-rtd-theme ; extra == "docs"
|
|
32
|
+
Requires-Dist: m2r2 ; extra == "docs"
|
|
33
|
+
Requires-Dist: sphinxcontrib.apidoc ; extra == "docs"
|
|
34
|
+
Requires-Dist: jupyter_sphinx ; extra == "docs"
|
|
35
|
+
Requires-Dist: pytest ; extra == "test"
|
|
36
|
+
Requires-Dist: pytest-cov ; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-flake8 ; extra == "test"
|
|
38
|
+
Requires-Dist: pytest-black ; extra == "test"
|
|
39
|
+
Requires-Dist: flake8==3.9.2 ; extra == "test"
|
|
40
|
+
Requires-Dist: tox ; extra == "test"
|
|
41
|
+
Requires-Dist: dirty-equals ; extra == "test"
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Provides-Extra: docs
|
|
44
|
+
Provides-Extra: test
|
|
45
|
+
|
|
46
|
+
# pyprocessors_standoff2inline
|
|
47
|
+
|
|
48
|
+
[](https://github.com/oterrier/pyprocessors_standoff2inline/blob/master/LICENSE)
|
|
49
|
+
[](https://github.com/oterrier/pyprocessors_standoff2inline/actions?query=workflow%3Atests)
|
|
50
|
+
[](https://codecov.io/gh/oterrier/pyprocessors_standoff2inline)
|
|
51
|
+
[](https://pyprocessors_standoff2inline.readthedocs.io)
|
|
52
|
+
[](https://pypi.org/project/pyprocessors_standoff2inline/)
|
|
53
|
+
[](https://pypi.org/project/pyprocessors_standoff2inline/)
|
|
54
|
+
|
|
55
|
+
StandoffToInline annotations coming from different annotators
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
You can simply `pip install pyprocessors_standoff2inline`.
|
|
60
|
+
|
|
61
|
+
## Developing
|
|
62
|
+
|
|
63
|
+
### Pre-requesites
|
|
64
|
+
|
|
65
|
+
You will need to install `flit` (for building the package) and `tox` (for orchestrating testing and documentation building):
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
python3 -m pip install flit tox
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Clone the repository:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
git clone https://github.com/oterrier/pyprocessors_standoff2inline
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Running the test suite
|
|
78
|
+
|
|
79
|
+
You can run the full test suite against all supported versions of Python (3.8) with:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
tox
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Building the documentation
|
|
86
|
+
|
|
87
|
+
You can build the HTML documentation with:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
tox -e docs
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The built documentation is available at `docs/_build/index.html.
|
|
94
|
+
|