Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

Script Overhaul #421

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 4 additions & 4 deletions images/degimpify.sh → images/scripts/degimpify.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Run this script on a directory to "degimpify" all XPM files
# within that directory (meaning any file ending with .XPM)
Expand All @@ -12,9 +12,9 @@ shopt -s nullglob
input_dirs="$*"

if [ $# -eq 0 ]; then
input_dirs[0]="./EditButtons"
input_dirs[1]="./TranscriptionImages"
input_dirs[2]="./ControlButtons"
input_dirs[0]="${BASH_SOURCE[0]}/../../images/EditButtons"
input_dirs[1]="${BASH_SOURCE[0]}/../../images/TranscriptionImages"
input_dirs[2]="${BASH_SOURCE[0]}/../../images/ControlButtons"
Comment on lines +15 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See lines 3-8.

Copy link
Contributor

@Semisol Semisol Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this syntax on a few of my systems and it sometimes does not work.
Also, collapsed it to $DIRNAME in my patch

Suggested change
input_dirs[0]="${BASH_SOURCE[0]}/../../images/EditButtons"
input_dirs[1]="${BASH_SOURCE[0]}/../../images/TranscriptionImages"
input_dirs[2]="${BASH_SOURCE[0]}/../../images/ControlButtons"
DIRNAME=$(dirname "${BASH_SOURCE[0]}")
input_dirs[0]="$DIRNAME/../../images/EditButtons"
input_dirs[1]="$DIRNAME/../../images/TranscriptionImages"
input_dirs[2]="$DIRNAME/../../images/ControlButtons"

fi

for dir in "${input_dirs[@]}"
Expand Down
7 changes: 3 additions & 4 deletions linux/AppRun.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
#!/bin/sh
# The AppImage runtime sets some special environment variables. We provide
# default values here in case the user tries to run this script outside an
# AppImage where the variables would otherwise be undefined.
if [[ ! "${APPIMAGE}" || ! "${APPDIR}" ]]; then
if [ ! "${APPIMAGE}" ] || [ ! "${APPDIR}" ]; then
export APPIMAGE="$(readlink -f "${0}")"
export APPDIR="$(dirname "${APPIMAGE}")"
fi
Expand All @@ -12,8 +12,7 @@ export LD_LIBRARY_PATH="${APPDIR}/lib:${LD_LIBRARY_PATH}"
export AUDACITY_PATH="${AUDACITY_PATH}:${APPDIR}/share/tenacity"
export AUDACITY_MODULES_PATH="${AUDACITY_MODULES_PATH}:${APPDIR}/lib/modules"

function help()
{
help() {
# Normal tenacity help
"${APPDIR}/bin/tenacity" --help
# Special options handled by this script
Expand Down
20 changes: 11 additions & 9 deletions linux/build-environment/dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#!/bin/sh

export TZ=Europe/London
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

apt_packages_basic=(
apt_packages_basic="
build-essential
python3-minimal
python3-pip
g++-9
libstdc++-9-dev
cmake
git
)
"

apt_packages_minimal_deps=(
apt_packages_minimal_deps="
libgtk2.0-dev
libasound2-dev
libavformat-dev
libjack-jackd2-dev
)
"

apt_packages_full_deps=(
apt_packages_full_deps="
zlib1g-dev
libexpat1-dev
libmp3lame-dev
Expand Down Expand Up @@ -51,12 +53,12 @@ apt_packages_full_deps=(
libcurl4-openssl-dev
libpng-dev
libjpeg-turbo8-dev
)
"

apt-get install -y --no-install-recommends \
"${apt_packages_basic[@]}" \
"${apt_packages_minimal_deps[@]}" \
"${apt_packages_full_deps[@]}"
"$apt_packages_basic" \
"$apt_packages_minimal_deps" \
"$apt_packages_full_deps"


pip3 install conan
2 changes: 1 addition & 1 deletion linux/build-environment/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh

conan --version

Expand Down
2 changes: 1 addition & 1 deletion linux/check_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh

version="@CPACK_PACKAGE_NAME@ v@CPACK_PACKAGE_VERSION@ @CPACK_AUDACITY_ARCH_LABEL@"

Expand Down
9 changes: 4 additions & 5 deletions locale/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ if( GETTEXT_FOUND )
mark_as_advanced( FORCE GETTEXT_MSGMERGE_EXECUTABLE )
set( msgfmt "${GETTEXT_MSGFMT_EXECUTABLE}" )
elseif( PYTHON )
set( msgfmt "${PYTHON}" "${TARGET_ROOT}/msgfmt.py" )
set( msgfmt "${PYTHON}" "${TARGET_ROOT}/scripts/msgfmt.py" )
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
nuget_package( pkgdir "Gettext.Tools" "0.20.1.1" )
nuget_package( pkgdir "Gettext.Tools" "0.21.0.1" )
file( TO_NATIVE_PATH "${pkgdir}/tools/bin/msgfmt.exe" msgfmt )
endif()

Expand Down Expand Up @@ -80,9 +80,8 @@ endforeach()
add_custom_target( "${TARGET}" ALL DEPENDS ${OUTPUTS} SOURCES "${SOURCES}" )

if( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" )
if( NOT WIN32)
install( DIRECTORY ${locale}/
TYPE LOCALE )
if( NOT WIN32 )
install( DIRECTORY ${locale} TYPE LOCALE )
endif()
endif()

10 changes: 6 additions & 4 deletions locale/diagnostics.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Report how complete each translation catalog is

Expand All @@ -8,9 +8,11 @@ total=`grep '^msgid' audacity.pot | wc -l`
#CSV header
echo "Name,Completed,Pct. completed,Bad lines"

declare -i badlines
badlines=0

for filename in *.po; do
[ -e "$filename" ] || break

for filename in `ls *.po`; do
# If there are errors from msgcmp, then the last line on standard error
# contains a count of problematic messages; else it won't match the
# pattern in awk, so assume no errors
Expand All @@ -20,7 +22,7 @@ for filename in `ls *.po`; do

# detect whether this sequence occurs in any .po file. It will break
# msgfmt on Windows.
badlines=`fgrep '#~|' ${filename} | wc -l`
badlines=`grep -Fc '#~|' "${filename}"`

# produce comma-separated values
echo "$filename,$complete,$((complete*100/total)),$badlines"
Expand Down
4 changes: 3 additions & 1 deletion locale/no_id.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

for i in *.po; do
sed -i '/^Project/d' $i
done
done
56 changes: 0 additions & 56 deletions locale/regen_POT_file.sh

This file was deleted.

13 changes: 6 additions & 7 deletions locale/LanguageNames.txt → locale/scripts/LanguageNames.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bg Български
bn বাংলা
bs Bosanski
ca Català
ca_ES@valencia Valencià
ca@valencia Valencià
co Corsu
cs Čeština
cy Cymraeg
Expand All @@ -15,7 +15,6 @@ el Ελληνικά
en English
es Español
eu Euskara
eu_ES Euskara (Espainiako)
fa فارسی
fi Suomi
fr Français
Expand All @@ -40,19 +39,19 @@ nb Norsk
nl Nederlands
oc Occitan
pl Polski
pt Português
pt_PT Português
pt_BR Português (Brasil)
ro Română
ru Русский
sk Slovenčina
sl Slovenščina
sr_RS Српски
sr_RS@latin Srpski
sr Српски
sr_Latn Srpski
sv Svenska
ta தமிழ்
tg Тоҷикӣ
tr Türkçe
uk Українська
vi Tiếng Việt
zh_CN 中文(简体)
zh_TW 中文(繁體)
zh 中文(简体)
zh_Hant 中文(繁體)
15 changes: 15 additions & 0 deletions locale/scripts/find-PO-no-Id.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Run this script on a directory to handle PO files with no id
DIRNAME=$(dirname "$0")

if [ $# -eq 0 ]; then
set -- "$DIRNAME/../"
fi

for dir in "$@"
do
for po_file in "${dir}"/*.po; do
sed -i '/^Project/d' "$po_file"
done
done
3 changes: 1 addition & 2 deletions locale/find-duplicates.pl → locale/scripts/find-POT-duplicates.pl
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use strict 'vars';

open(my $fh, "<", "audacity.pot")
or die "Can't open < audacity.pot: $!";
open(my $fh, "<", "../tenacity.pot") or die "Can't open < ../tenacity.pot: $!";

my @sourcelines = ();

Expand Down
2 changes: 1 addition & 1 deletion locale/fix_po_files.py → locale/scripts/fix-PO-files.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import polib
import os

localedir = './'
localedir = '../'
count_seen = 0
count_modified = 0

Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions locale/scripts/locale_diagnostics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

# Report how complete each translation catalog is

# How many messages in total?
total=$(grep -c '^msgid' "../tenacity.pot")


declare -i badlines
for po_file in ../*.po; do
# If there are errors from msgcmp, then the last line on standard error
# contains a count of problematic messages; else it won't match the
# pattern in awk, so assume no errors
errors=$(msgcmp "$po_file" "../tenacity.pot" 2>&1 | awk '/msgcmp: found [0-9]* fatal error/ { nn = $3 } END {print 0+nn}')
complete=$((total-errors))

# detect whether this sequence occurs in any .po file. It will break msgfmt on Windows.
badlines=$(grep -F -c '#~|' "${po_file}")

echo "$po_file: completed $complete of $total ($((complete*100/total))%); Windows Incompatible Lines: $badlines"
done | sort -n -t , -k3

exit 0
File renamed without changes.
46 changes: 46 additions & 0 deletions locale/scripts/regen_POT_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh
# Run this script with /locale/script/ as the current directory
set -o errexit

DIRNAME=$(dirname "$0")

echo ";; Recreating tenacity.pot using .h, .cpp and .mm files"
for path in "$DIRNAME/../modules/mod-*" "$DIRNAME/../libraries/lib-*" "$DIRNAME/../include" "$DIRNAME/../src" ; do
find "$path" -name \*.h -o -name \*.cpp -o -name \*.mm
done | LANG=c sort | \
sed -E 's/\.\.\///g' |\
xargs xgettext \
--no-wrap \
--default-domain=tenacity \
--directory="$DIRNAME/../.." \
--keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \
--add-comments=" i18n" \
--add-location=file \
--copyright-holder='Tenacity Contributors' \
--package-name="tenacity" \
--package-version='3.0.4' \
--msgid-bugs-address="[email protected]" \
--add-location=file -L C -o "$DIRNAME/../tenacity.pot"

echo ";; Adding nyquist files to tenacity.pot"
for path in "$DIRNAME/../../plug-ins/"* ; do find "$path" -name \*.ny -not -name rms.ny; done | LANG=c sort | \
sed -E 's/\.\.\///g' |\
xargs xgettext \
--no-wrap \
--default-domain=tenacity \
--directory="$DIRNAME/../.." \
--keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \
--add-comments=" i18n" \
--add-location=file \
--copyright-holder='Tenacity Contributors' \
--package-name="tenacity" \
--package-version='3.0.4' \
--msgid-bugs-address="[email protected]" \
--add-location=file -L Lisp -j -o "$DIRNAME/../tenacity.pot"

echo ""
echo ";; POT file generated"
echo ""

head -n 11 "$DIRNAME/../tenacity.pot" | tail -n 3
wc -l "$DIRNAME/../tenacity.pot"
Loading