diff --git a/default.nix b/default.nix index 530794ea..1703505e 100644 --- a/default.nix +++ b/default.nix @@ -7,7 +7,6 @@ hpp-tutorial, libsForQt5, pkg-config, - python3Packages, }: stdenv.mkDerivation { @@ -24,17 +23,6 @@ stdenv.mkDerivation { ]; }; - prePatch = '' - substituteInPlace scripts/auto-install-hpp.sh \ - --replace-fail /bin/bash ${stdenv.shell} - substituteInPlace scripts/install-tar-on-remote \ - --replace-fail /bin/bash ${stdenv.shell} - substituteInPlace scripts/generate-tar-doc \ - --replace-fail /bin/sh ${stdenv.shell} - substituteInPlace scripts/packageDep \ - --replace-fail /usr/bin/python ${python3Packages.python.interpreter} - ''; - strictDeps = true; nativeBuildInputs = [ diff --git a/scripts/auto-install-hpp.sh b/scripts/auto-install-hpp.sh index d24229ed..2b7db5d4 100755 --- a/scripts/auto-install-hpp.sh +++ b/scripts/auto-install-hpp.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Exit on error set -e diff --git a/scripts/create-tags.sh b/scripts/create-tags.sh index 01e2299f..4e287db8 100755 --- a/scripts/create-tags.sh +++ b/scripts/create-tags.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/scripts/generate-tar-doc b/scripts/generate-tar-doc index 134d7f8b..8280f584 100755 --- a/scripts/generate-tar-doc +++ b/scripts/generate-tar-doc @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # generate-tar-doc $DEVEL_HPP_DIR/install/share/doc http://gepettoweb.laas.fr/hpp # then copy /tmp/hpp.tar.gz on server and inflate archive. diff --git a/scripts/install-tar-on-remote b/scripts/install-tar-on-remote index 52d7b970..72e15bb8 100755 --- a/scripts/install-tar-on-remote +++ b/scripts/install-tar-on-remote @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash VERSION="v4.6.0" HOST=gepettoweb.laas.fr diff --git a/scripts/packageDep b/scripts/packageDep index 89e135af..1ccd1a77 100755 --- a/scripts/packageDep +++ b/scripts/packageDep @@ -1,10 +1,11 @@ -#!/usr/bin/python +#!/usr/bin/env python from __future__ import print_function, with_statement -from optparse import OptionParser +import os import re -import sys, os +import sys +from optparse import OptionParser try: # python2 from commands import getstatusoutput @@ -12,15 +13,22 @@ except: # python3 from subprocess import getstatusoutput pkgConfigPath = os.environ.get("PKG_CONFIG_PATH") -pathList = re.split(':', pkgConfigPath) +pathList = re.split(":", pkgConfigPath) usage = "usage: %prog [options] package-1 ... package-n" parser = OptionParser(version="packageDep 0.1", usage=usage) -parser.add_option("-o", "--output", dest="filename", - help="write graph to FILE", metavar="FILE") -parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, - help="Do not print messages to stdout") +parser.add_option( + "-o", "--output", dest="filename", help="write graph to FILE", metavar="FILE" +) +parser.add_option( + "-q", + "--quiet", + action="store_true", + dest="quiet", + default=False, + help="Do not print messages to stdout", +) (options, args) = parser.parse_args() @@ -28,17 +36,18 @@ if options.filename is None: parser.print_help() if options.quiet: - sys.stdout = open(os.devnull, 'w') + sys.stdout = open(os.devnull, "w") packageList = args filename = options.filename -requireExpr = re.compile('(\s*Requires:\s+)(.+)') -pkgStdName = re.compile('\w+[\w\d\._-]*'); +requireExpr = re.compile("(\s*Requires:\s+)(.+)") +pkgStdName = re.compile("\w+[\w\d\._-]*") packageSet = set() dependencySet = set() + def extractDep(inPkg): packageSet.add(inPkg) @@ -48,22 +57,22 @@ def extractDep(inPkg): for path in pathList: found = False - filePc = path+"/"+inPkg+".pc" + filePc = path + "/" + inPkg + ".pc" try: with open(filePc) as f: for line in f: matchLine = requireExpr.match(line) if matchLine: - requireList = re.split(':', matchLine.group(0)) + requireList = re.split(":", matchLine.group(0)) depLine = requireList[1] - depFullList = re.split(',', depLine) + depFullList = re.split(",", depLine) for depFull in depFullList: dep = pkgStdName.search(depFull) if dep: depName = dep.group(0) depSet.add(depName) - depString = "\"" + depName + "\" -> \"" + inPkg + "\"" + depString = '"' + depName + '" -> "' + inPkg + '"' dependencySet.add(depString) except IOError: @@ -76,22 +85,22 @@ def extractDep(inPkg): def getDocLink(package): cmd = "pkg-config --variable=doxygendocdir " + package - status,output = getstatusoutput(cmd) + status, output = getstatusoutput(cmd) if status != 0: - return '' + return "" - if output != '': + if output != "": return output cmd = "pkg-config --variable=docdir " + package - status,output = getstatusoutput(cmd) + status, output = getstatusoutput(cmd) if status != 0: - return '' + return "" - if output != '': - return output + '/html' + if output != "": + return output + "/html" return output @@ -103,24 +112,24 @@ for pkg in packageList: # try: - f = open(filename, 'w') + f = open(filename, "w") except IOError: print("cannot open ", filename) f.write("digraph CD {\n") -f.write("\tsize = \"12,15\"\n") +f.write('\tsize = "12,15"\n') f.write("\trankdir = BT\n") f.write("\tcompound=true\n") f.write("\n") for package in packageSet: docLink = getDocLink(package) - if docLink != '': - docLink = docLink + '/index.html' - f.write("\t\"" + package + "\" [shape = box, href = \"" + docLink + "\"]\n") + if docLink != "": + docLink = docLink + "/index.html" + f.write('\t"' + package + '" [shape = box, href = "' + docLink + '"]\n') for dependency in dependencySet: - f.write("\t" + dependency + "\n"); + f.write("\t" + dependency + "\n") f.write("}\n")