XML format for Jenkins - python

I am writing an automated test script in python and I need to integrate this to jenkins so that the test result output can be seen in jenkins for each module.
I am not so familiar with XML and I see that Jenkins is not able to understand the XML output I try to create in my script.
Is there any means in python by which I transform my XML format to the XSD provided by Jenkins?
Because of the restrictions I cannot install any libraries like lxml. I am having to use basic python libraries that comes with 2.7.1 version.

Have a look at generateDS

Related

How to perform code signing on a python script?

How to perform code signing on a python script? Like in Powershell, there is Set-AuthenticodeSignature for signing scripts.
I have already tried using Microsoft signtool.exe but it only works for EXEs and DLLs, not for PY/PYC files.
In python, I could not find any module for code signing.
Please help.
Well a solution would be to freeze your Python code and then you will be able to sign the resulting exe.
For some info on how to freeze your Python you can start by taking a look at this.

Jenkins shared library: How to run code from a python module contained in a package?

I want to run a python script as part of a jenkins pipline triggered from a github repo. If I store the script directly in the repo itself, I can just do sh 'python path/to/my_package/script.py' which work perfectly. However since I want to use this from multiple pipelines from multiple repos, I want to put this in a jenkins shared library.
I found this question which suggested storing the python file in the resources directory and copying it to a temp file before use. That only works if the script is one standalone file. Unfortunately, mine is a package with multiple python files and imports between them, so thats a no go. I also tried to copy the entire folder containing the python package from the answer to this question, which suggests getting the location of the library with
import groovy.transform.SourceURI
import java.nio.file.Path
import java.nio.file.Paths
class ScriptSourceUri {
#SourceURI
static URI uri
}
but its gives me the following error:
Scripts not permitted to use staticMethod java.net.URI create java.lang.String. Administrators can decide whether to approve or reject this signature.
It seems that some additional permissions are required, which I don't think I'll be able to acquire (its a shared machine).
So? Does anyone know how I can run a python package from jenkins shared library? Right now the only solution I can think of is to manually recreate the directory structure of the python package, which is obviously very messy and non-generic.
PS: There is no particular reason for using the python script over writing the same script in groovy. Its just that the python script is well tested, well understood and well supported. Rewriting the whole thing in groovy just isn't feasible right now.
You can go to http://host:8080/jenkins/scriptApproval/ page of your Jenkins installation and approve the request for your scripts, please see below:-
And follow the link for more information.

Need source code for _xmlplus in Python

We were using Python 2.4 in our application. Now we are migrating to 2.7.8.
In our code, we had used Sax2 and xpath functionality from "_xmlplus" library.
Approach 1:
We started off by re-writing the parsing logic used in all those files (ie files where Sax2 and xpath were used), but this is a tedious job.
Approach 2:
Use _xmlplus for 2.7 version. For which we need the source code for "_xmlplus". So that we can build the library. (We were not able to find the source code in web)
Can anyone please suggest the right approach, which we should take ?
It appears that _xmlplus is a package from PyXML library, so the source is available on sourceforge. However note that PyXML is no longer maintained (last files are from 2004).

query rdf file windows

I wanna know how to query a RDF file using Sparql on windows. I'm using python 2.7 and on linux os.system(roqet... ) is there something similar to roqet (rasqal) on windows, like curl for example?, can I make this query with rdflib or something like that? it is very important that this rdf is not online, I wanna perform this query locally through the file.
Thanks
Take a look at either the ARQ tools provided by Apache Jena which will run on Windows provided Java is installed
Or take a look at the rdfQuery tool provided by dotNetRDF which will run on Windows provided .Net 4.0 Full is installed
Disclaimer - I'm a developer on both of the above projects
If your file is reasonably small (less than a few 100,000 triples), I would highly recommend RDFlib, as you suggested. It can be used anywhere you've installed Python and allows full use of SPARQL (both select and update/delete statements), and also gives many other handy features that can be utilized on a local file completely in-memory.
The nice part about using RDFlib is that to get it up and running requires only adding the Python library, so it is very simple to install.

Python: Is there a way to generate xsd files based on xml examples

I have a list of xml examples I would like to turn into schemas (xsd files). Exactly what the trang tool does (http://www.thaiopensource.com/relaxng/trang.html). I don't like calling trang from my script (i.e doing os.system('java -jar trang...')) - is there a python package I can use instead?
If you are running Jython (http://jython.org/) then you could import trang and run it internally.

Categories

Resources