casalogger package for CASA 6
Source
xxxxxxxxxx
#!/usr/bin/perl
use :: ;
use :: ;
use :: ;
use qw(strftime);
%subst = ( );
@subst_files = ( "private/casaloggertool.py" );
sub {
my $root = shift(@_);
for $f ( @subst_files ) {
my $path = "$root/$f";
open( , "< $path");
@dest = <>;
close( );
open( , "> $path");
foreach ( @dest ) {
foreach $k ( keys %subst ) {
$k|$subst{$k}|; |
print $_;
}
}
close( );
}
}
sub {
my ($from, $to) = @_;
my $cmd;
if ( - $from || (- $from && $from =~ |/$|) ) {
$cmd = "rsync -aq $from $to";
} else {
$cmd = "rsync -aq $from/ $to";
}
print("\t$cmd\n");
open( , "$cmd 2>&1 |" );
for ( <> ) { print "\t>\t$_" }
close( );
}
sub {
my $path = shift(@_);
my $name = ($path);
my $dir = ($path);
if ( ! - $path ) { die "protobuf spec, '$name', is not a file" }
return ( $dir, $name );
}
$prefix = "";
$app_path = "";
$build_number = "";
foreach ( @ARGV ) {
^ =$| && ( next ); |
^=(.*)| && ( $prefix = $1, next ); |
^=(.*)| && ( $app_path = $1, next ); |
^=(\ +.\ +.\+)$| && ( $build_number = $1, next ); |
if ( |^ =| ) { die "build number must be a number" }
die "unknown option: $_";
}
if ( ! $prefix ) { die "no prefix specified" };
if ( ! - $prefix) { ($prefix) }
if ( ! - $prefix) { die "cannot create prefix" }
if ( ! $app_path ) { die "no prefix specified" };
$app_name = ($app_path);
if ( $^O eq "darwin" ) {
if ( ! - $app_path ) { die "app directory does not exist (or is not a directory)" }
my( $filename, $dirs, $suffix ) = ( $app_path, ".app" );
$app_exe = "__bin__/$app_name/Contents/MacOS/$filename";
$subst{'@APP@'} = $app_exe;
# Apple Silicon Macs use Qt5, which requires that qt.conf is present
$cpuarch=`uname -m`;
chomp($cpuarch);
print ("CPU Architecture: '$cpuarch'\n");
if ($cpuarch eq "arm64") {
open my $fileHandle, ">>", "$app_path/Contents/Resources/qt.conf" or die "Can't open '$app_path/Contents/Resources/qt.conf'\n";
close $fileHandle;
}
} else {
if ( ! - $app_path ) { die "app image does not exist" }
$app_exe = "__bin__/$app_name";
$subst{'@APP@'} = $app_exe;
}
"src/casalogger", $prefix); (
$prefix); (