mirror of
https://github.com/nasa/trick.git
synced 2025-02-21 01:31:25 +00:00
parent
4611db2e92
commit
bde2ec5158
@ -14,6 +14,7 @@ use trick_version ;
|
||||
use Digest::MD5 qw(md5_hex) ;
|
||||
use File::Path qw(make_path) ;
|
||||
use html ;
|
||||
use get_paths ;
|
||||
|
||||
##
|
||||
## ================================================================================
|
||||
@ -127,10 +128,6 @@ if ( $help ) {
|
||||
|
||||
@include_dirs = $ENV{"TRICK_CFLAGS"} =~ /-I\s*(\S+)/g ; # get include paths from TRICK_CFLAGS
|
||||
|
||||
# Get environment variables, split on colons, strip leading/trailing whitespace, remove empty elements, get absolute paths then remove more empty elements
|
||||
sub get_paths {
|
||||
return grep { $_ ne ''} map abs_path($_), grep { $_ ne '' } map { s/(^\s+|\s+$)//g ; $_ } split /:/, $ENV{$_[0]} ;
|
||||
}
|
||||
@exclude_paths = get_paths( "TRICK_EXCLUDE") ;
|
||||
@swig_exclude_paths = get_paths( "TRICK_SWIG_EXCLUDE") ;
|
||||
@ext_lib_paths = get_paths( "TRICK_EXT_LIB_DIRS") ;
|
||||
|
@ -10,6 +10,7 @@ use gte ;
|
||||
use Digest::MD5 qw(md5_hex) ;
|
||||
use trick_version ;
|
||||
use html ;
|
||||
use get_paths ;
|
||||
use strict ;
|
||||
|
||||
my @exclude_paths ;
|
||||
@ -24,21 +25,6 @@ my %trick_headers ;
|
||||
my %python_modules ;
|
||||
my %python_module_dirs ;
|
||||
|
||||
sub get_paths {
|
||||
my @paths = split /:/ , $ENV{$_[0]} ;
|
||||
if (scalar @paths) {
|
||||
@paths = sort(@paths ) ;
|
||||
# trim whitespace
|
||||
@paths = map { s/(^\s+|\s+$)//g ; $_ } @paths ;
|
||||
# Remove empty elements. Sort forced all blank names to the front.
|
||||
while ( scalar @paths and not length @paths[0] ) {
|
||||
shift @paths ;
|
||||
}
|
||||
@paths = map { (-e $_) ? abs_path($_) : $_ } @paths ;
|
||||
}
|
||||
return @paths ;
|
||||
}
|
||||
|
||||
sub read_files_to_process() {
|
||||
my @include_paths ;
|
||||
my $cc ;
|
||||
|
15
libexec/trick/pm/get_paths.pm
Normal file
15
libexec/trick/pm/get_paths.pm
Normal file
@ -0,0 +1,15 @@
|
||||
package get_paths ;
|
||||
|
||||
use Exporter ();
|
||||
use Cwd 'abs_path' ;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(get_paths);
|
||||
|
||||
use strict ;
|
||||
|
||||
# Get environment variables, split on colons, strip leading/trailing whitespace, remove empty elements, get absolute paths then remove more empty elements
|
||||
sub get_paths {
|
||||
return grep { $_ ne ''} map abs_path($_), grep { $_ ne '' } map { s/(^\s+|\s+$)//g ; $_ } split /:/, $ENV{$_[0]} ;
|
||||
}
|
||||
|
||||
1;
|
Loading…
x
Reference in New Issue
Block a user