| 1 | package App::Netdisco::Util::Python; | ||
| 2 | |||
| 3 | use Dancer qw/:syntax :script/; | ||
| 4 | |||
| 5 | use Path::Class; | ||
| 6 | use File::ShareDir 'dist_dir'; | ||
| 7 | use Alien::ultraviolet; | ||
| 8 | |||
| 9 | use base 'Exporter'; | ||
| 10 | our @EXPORT = (); | ||
| 11 | our @EXPORT_OK = qw/py_install py_cmd/; | ||
| 12 | our %EXPORT_TAGS = (all => \@EXPORT_OK); | ||
| 13 | |||
| 14 | sub cipactli { | ||
| 15 | my $uv = Alien::ultraviolet->uv; | ||
| 16 | my $cipactli = Path::Class::Dir->new( dist_dir('App-Netdisco') ) | ||
| 17 | ->subdir('python')->subdir('netdisco')->stringify; | ||
| 18 | |||
| 19 | return ($uv, '--no-cache', '--no-progress', '--quiet', '--project', $cipactli); | ||
| 20 | } | ||
| 21 | |||
| 22 | sub py_install { | ||
| 23 | return (cipactli(), 'sync'); | ||
| 24 | } | ||
| 25 | |||
| 26 | sub py_cmd { | ||
| 27 | return (cipactli(), 'run', @_); | ||
| 28 | } | ||
| 29 | |||
| 30 | true; |