App-Deps-Verify
view release on metacpan or search on metacpan
lib/App/Deps/Verify.pm view on Meta::CPAN
@{ $self->_load_yamls($args) }
],
}
);
}
sub _find_exes
{
my ( $self, $args ) = @_;
my @not_found;
foreach my $line ( map { @$_ } @{ $args->{inputs} } )
{
my $cmd = $line->{exe};
if (
not(
( $cmd =~ m{\A/} )
? ( -e $cmd )
: ( defined( scalar( which($cmd) ) ) )
)
)
{
push @not_found, $line;
}
}
if (@not_found)
{
print "The following commands could not be found:\n\n";
foreach my $cmd ( sort { $a->{exe} cmp $b->{exe} } @not_found )
{
print "$cmd->{exe}\t$cmd->{url}\n";
}
exit(-1);
}
return;
}
sub list_perl5_modules
{
lib/App/Deps/Verify.pm view on Meta::CPAN
$reqs->{$m} = 1;
}
}
return +{ perl5_modules => [ sort { $a cmp $b } keys %$reqs ] };
}
sub _find_perl5_modules
{
my ( $self, $args ) = @_;
my @not_found;
foreach my $required_modules ( @{ $args->{inputs} } )
{
foreach my $m ( sort { $a cmp $b } keys(%$required_modules) )
{
my $v = $required_modules->{$m};
local $SIG{__WARN__} = sub { };
my $verdict = eval( "use $m " . ( $v || '' ) . ' ();' );
my $Err = $@;
if ($Err)
{
push @not_found, $m;
}
}
}
if (@not_found)
{
print "The following modules could not be found:\n\n";
foreach my $module (@not_found)
{
print "$module\n";
}
exit(-1);
}
return;
}
sub list_missing_python3_modules
{
my ( $self, $args ) = @_;
my %not_found;
foreach my $mods ( @{ $args->{inputs} } )
{
use Data::Dumper;
# die Dumper($mods);
my @required_modules = keys %{$mods};
REQUIRED:
foreach my $module (@required_modules)
{
if ( $module !~ m#\A[a-zA-Z0-9_\.]+\z# )
{
die "invalid python3 module id - $module !";
}
if ( exists $not_found{$module} )
{
next REQUIRED;
}
if ( system( 'python3', '-c', "import $module" ) != 0 )
{
$not_found{$module} = 0;
}
}
}
return { missing_python3_modules =>
[ map { +{ module => $_, }, } sort keys(%not_found) ] };
}
sub _find_python3_modules
{
my ( $self, $args ) = @_;
my @not_found =
map { $_->{module} }
@{ $self->list_missing_python3_modules($args)->{missing_python3_modules}
};
if (@not_found)
{
print "The following python3 modules could not be found:\n\n";
foreach my $module (@not_found)
{
print "$module\n";
}
exit(-1);
}
return;
}
sub _find_required_files
{
my ( $self, $args ) = @_;
my @not_found;
foreach my $required_files ( @{ $args->{inputs} } )
{
foreach my $path (@$required_files)
{
my $p = $path->{path};
if ( $p =~ m#[\\\$]# )
{
die "Invalid path $p!";
}
if ( !-e ( $p =~ s#\A~/#$ENV{HOME}/#r ) )
{
push @not_found, $path;
}
}
}
if (@not_found)
{
print "The following required files could not be found.\n";
print "Please set them up:\n";
print "\n";
foreach my $path (@not_found)
{
print "$path->{path}\n$path->{desc}\n";
}
exit(-1);
}
return;
}
sub find_deps
{
( run in 0.225 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )