Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace encodestring by encodebytes for py3.9 compatibility #38

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,20 @@ pipeline {

"PloneSaaS": {
node(label: 'docker') {
sh '''docker pull eeacms/plonesaas-devel;docker run -i --rm --name="$BUILD_TAG-plonesaas" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plonesaas-devel /debug.sh bin/test --test-path /plone/instance/src/$GIT_NAME -v -vv -s $GIT_NAME'''
script {
try {
sh '''docker pull eeacms/plonesaas-devel; docker run -i --name="$BUILD_TAG-plonesaas" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plonesaas-devel /debug.sh coverage'''
sh '''mkdir -p xunit-reports; docker cp $BUILD_TAG-plonesaas:/plone/instance/parts/xmltestreport/testreports/. xunit-reports/'''
stash name: "xunit-reports", includes: "xunit-reports/*.xml"
sh '''docker cp $BUILD_TAG-plonesaas:/plone/instance/src/$GIT_NAME/coverage.xml coverage.xml'''
stash name: "coverage.xml", includes: "coverage.xml"
} finally {
sh '''docker rm -v $BUILD_TAG-plonesaas'''
}
junit 'xunit-reports/*.xml'
}
}
}

},
)
}
}
Expand All @@ -157,7 +167,7 @@ pipeline {
def nodeJS = tool 'NodeJS11';
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s|/plone/instance/src/$GIT_NAME|$(pwd)|g" coverage.xml'''
sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPath=coverage.xml -Dsonar.sources=. -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPaths=coverage.xml -Dsonar.sources=./sparql-client -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
}
Expand Down
7 changes: 7 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

3.9-dev0 - (unreleased)
---------------------------
* fix import error on older python versions
[valipod refs #140578]
* Bug fix: replace encodestring by encodebytes for py3.9 compatibility
[valipod refs #140578]

3.8 - (2020-06-17)
---------------------------
* Bug fix: fixed Python3 query execution
Expand Down
7 changes: 5 additions & 2 deletions sparql.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
Otherwise, the query is read from standard input.
"""

from base64 import encodestring
try:
from base64 import encodestring
except ImportError:
from base64 import encodebytes as encodestring
from six.moves import input, map
from six.moves.urllib.parse import urlencode
from xml.dom import pulldom
Expand Down Expand Up @@ -502,7 +505,7 @@ def _build_request(self, query):
separator = '&'
else:
separator = '?'
uri = self.endpoint.strip() + separator + query
uri = self.endpoint.strip() + str(separator) + str(query)
return ev_request.Request(uri)
else:
# uri = self.endpoint.strip().encode('ASCII')
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8
3.9-dev0