From 51855831c19e1a5550e89142209f3dfef09365b1 Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Wed, 14 Mar 2018 10:45:34 -0700 Subject: [PATCH] formally removing python-prefix and revision scripts --- Makefile.am | 2 - python-prefix.py | 36 ---------- revision.sh | 173 ----------------------------------------------- 3 files changed, 211 deletions(-) delete mode 100755 python-prefix.py delete mode 100755 revision.sh diff --git a/Makefile.am b/Makefile.am index 4cfea830..28043555 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,8 +34,6 @@ EXTRA_DIST = bootstrap.sh \ README.md \ ASSIGNMENT_OF_COPYRIGHT.pdf \ Changelog \ - python-prefix.py \ - revision.sh \ .version \ .version.date diff --git a/python-prefix.py b/python-prefix.py deleted file mode 100755 index 20a50d75..00000000 --- a/python-prefix.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python - -import os.path -import site -import sys - - -def main(): - """ - Check if the given prefix is included in sys.path for the given - python version; if not find an alternate valid prefix. Print the - result to standard out. - """ - if len(sys.argv) != 3: - msg = "usage: %s \n" % os.path.basename(sys.argv[0]) - sys.stderr.write(msg) - return 1 - python_prefix = sys.argv[1] - python_version = sys.argv[2] - path = "%s/lib/python%s" % (python_prefix, python_version) - path = os.path.normpath(path) - if path[-1] != "/": - path += "/" - prefix = None - for p in sys.path: - if p.startswith(path): - prefix = python_prefix - break - if not prefix: - prefix = site.PREFIXES[-1] - sys.stdout.write("%s\n" % prefix) - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/revision.sh b/revision.sh deleted file mode 100755 index 661506fe..00000000 --- a/revision.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/sh - -usage() -{ - echo "usage: $(basename $0) (-d | [])" >&2 - exit $1 -} - -func=revision -while getopts dh f; do - case $f in - d) - func=date - ;; - - h) - usage 0 - ;; - - *) - usage 1 - ;; - esac -done -shift $(($OPTIND - 1)) - -case $func in - revision) - if [ $# -lt 1 -o $# -gt 2 ]; then - usage 1 - fi - ;; - - date) - if [ $# -gt 0 ]; then - usage 1 - fi - ;; - - *) - usage 1 - ;; -esac - -_revision() -{ - if [ -r .version ]; then - cat .version - else - echo $1$2 - fi -} - -git_revision() -{ - local ver versuffix describe untagged commits branch sha dirty - - ver=$1 - versuffix=$2 - - describe=$(git describe --tags --dirty 2> /dev/null) - if [ "$describe" ]; then - echo "$describe" | sed -e 's/^release-//' - return - fi - - if [ ! "$(git tag -l release-$ver)" ]; then - untagged=".untagged" - else - commits=$(git rev-list release-${ver}^..HEAD | wc -l) - if [ $commits -eq 0 ]; then - commits="" - else - commits=".$commits" - fi - fi - - branch=$(git rev-parse --abbrev-ref HEAD) - if [ "$branch" = master ]; then - branch="" - else - branch=".$(echo -n $branch | tr -sC '.[:alnum:]' '[.*]')" - fi - - if [ "$untagged" -o "$commits" ]; then - sha=.g$(git log -1 --pretty="%h") - fi - - if ! git diff --quiet; then - dirty=".dirty" - else - dirty="" - fi - - echo ${ver}${versuffix}${untagged}${commits}${branch}${sha}${dirty} -} - -svn_revision() -{ - local ver versuffix tagrev untagged commits rev dirty - - ver=$1 - versuffix=$2 - - tagrev=$(svn log -q ^/tags/release-$ver --limit 1 2> /dev/null | \ - awk '/^r/ {print $1}') - if [ ! "$tagrev" ];then - untagged=".untagged" - else - commits=$(svn log -q -r $tagrev:HEAD | grep '^r' | wc -l) - if [ $commits -eq 0 ]; then - commits="" - else - commits=".$commits" - fi - fi - - if [ "$untagged" -o "$commits" ]; then - rev=.s$(svn info | awk '/^Revision:/ {print $2}') - fi - - if (svn status -q | grep -q .); then - dirty=".dirty" - fi - - echo ${ver}${versuffix}${untagged}${commits}${rev}${dirty} -} - -_date() -{ - if [ -r .version.date ]; then - cat .version.date - else - date '+%Y%m%d' - fi -} - -git_date() -{ - local date - - if git diff --quiet; then - date=$(git log -1 --format='%ci' | \ - awk '{gsub("-", "", $1); print $1}') - else - date=$(_date) - fi - - echo $date -} - -svn_date() -{ - local date - - if ! (svn status -q | grep -q .); then - date=$(svn log -q --limit 1 | \ - awk '/^r[0-9]+/ {gsub("-", "", $5); print $5}') - else - date=$(_date) - fi - - echo $date -} - -repo="" -if test -d .git || git rev-parse --git-dir > /dev/null 2>&1; then - repo=git -elif test -d .svn || svn info > /dev/null 2>&1; then - repo=svn -fi - -${repo}_${func} "$@"