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

portability: use interpreters from /usr/bin/env #105

Merged
merged 4 commits into from
Jul 24, 2024
Merged
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
12 changes: 0 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ variables:

stable-24.04-build:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:24.04
allow_failure: true
only:
- stable
<<: *build_definition
Expand All @@ -83,15 +82,13 @@ stable-22.04-build:
<<: *build_definition

stable-20.04-build:
allow_failure: true
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:20.04
only:
- stable
<<: *build_definition

devel-24.04-build:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:24.04
allow_failure: true
only:
- devel
<<: *build_definition
Expand All @@ -104,14 +101,12 @@ devel-22.04-build:

devel-20.04-build:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:20.04
allow_failure: true
only:
- devel
<<: *build_definition

stable-24.04-test:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:24.04
allow_failure: true
dependencies:
- stable-24.04-build
only:
Expand All @@ -128,7 +123,6 @@ stable-22.04-test:

stable-20.04-test:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:20.04
allow_failure: true
dependencies:
- stable-20.04-build
only:
Expand All @@ -137,7 +131,6 @@ stable-20.04-test:

devel-24.04-test:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:24.04
allow_failure: true
dependencies:
- devel-24.04-build
only:
Expand All @@ -154,7 +147,6 @@ devel-22.04-test:

devel-20.04-test:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:20.04
allow_failure: true
dependencies:
- devel-20.04-build
only:
Expand All @@ -163,7 +155,6 @@ devel-20.04-test:

stable-24.04-doc:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:24.04
allow_failure: true
dependencies:
- stable-24.04-build
only:
Expand All @@ -172,7 +163,6 @@ stable-24.04-doc:

stable-22.04-doc:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:22.04
allow_failure: true
dependencies:
- stable-22.04-build
only:
Expand All @@ -189,7 +179,6 @@ stable-20.04-doc:

devel-24.04-doc:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:24.04
allow_failure: true
dependencies:
- devel-24.04-build
only:
Expand All @@ -198,7 +187,6 @@ devel-24.04-doc:

devel-22.04-doc:
image: gitlab.laas.fr:4567/humanoid-path-planner/hpp-doc:22.04
allow_failure: true
dependencies:
- devel-22.04-build
only:
Expand Down
9 changes: 1 addition & 8 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,9 @@ 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}
--replace-fail "/usr/bin/env python3" ${python3Packages.python.interpreter}
'';

strictDeps = true;

nativeBuildInputs = [
Expand Down
2 changes: 1 addition & 1 deletion scripts/auto-install-hpp.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Exit on error
set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-tags.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-tar-doc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-tar-on-remote
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

VERSION="v4.6.0"
HOST=gepettoweb.laas.fr
Expand Down
74 changes: 38 additions & 36 deletions scripts/packageDep
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
#!/usr/bin/python
#!/usr/bin/env python3

from __future__ import print_function, with_statement

from optparse import OptionParser
import os
import re
import sys, os

try: # python2
from commands import getstatusoutput
except: # python3
from subprocess import getstatusoutput
import sys
from optparse import OptionParser
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()

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)
Expand All @@ -47,23 +50,22 @@ def extractDep(inPkg):
"""Loop over directories in PKG_CONFIG_PATH """

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:
Expand All @@ -76,22 +78,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


Expand All @@ -103,24 +105,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")