From 6ccd72ab96cfba36c217a77641b3b8a91906c512 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 8 Dec 2018 09:05:12 +0100 Subject: tools: Add version info to merged WARCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for #9. I was hoping to reuse one of schema.org’s microdata schema’s, but neither Action (archival action) nor SoftwareApplication (version information) seem to be suitable. --- crocoite/util.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crocoite/util.py') diff --git a/crocoite/util.py b/crocoite/util.py index da6d54a..bd26909 100644 --- a/crocoite/util.py +++ b/crocoite/util.py @@ -22,7 +22,7 @@ Random utility functions """ -import random, sys +import random, sys, platform import hashlib, pkg_resources from urllib.parse import urlsplit, urlunsplit @@ -43,6 +43,18 @@ def removeFragment (u): s = urlsplit (u) return urlunsplit ((s.scheme, s.netloc, s.path, s.query, '')) +def getSoftwareInfo (): + """ Get software info for inclusion into warcinfo """ + return { + 'platform': platform.platform (), + 'python': { + 'implementation': platform.python_implementation(), + 'version': platform.python_version (), + 'build': platform.python_build () + }, + 'self': getRequirements (__package__) + } + def getRequirements (dist): """ Get dependencies of a package. -- cgit v1.2.3