Alien-CPython3

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN


  my @paths_to_check;

  File::Find::find(
    sub { push @paths_to_check, path($File::Find::name) if -f && -B },
    $version_base );

  my %paths_changed;

  # Turn paths from PYTHON_FRAMEWORK_PREFIX to @rpath/Python.framework.
  my $frameworks_path = path(PYTHON_FRAMEWORK_PREFIX)->parent;
  my $rpathify = sub {
    my ($path) = @_;
    return unless index($path, PYTHON_FRAMEWORK_PREFIX . '/') == 0;
    return File::Spec->catfile(
      '@rpath',
      File::Spec->abs2rel($path, $frameworks_path)
    );
  };
  for my $change_path (@paths_to_check) {
    next if exists $paths_changed{$change_path};
    my $libs;
    $build->log("Skipping $change_path\n"), next unless eval { $libs = _otool_libs( $change_path ); 1 };
    $paths_changed{$change_path} = 1;

    $change_path->chmod('u+w');

    my $path_rel_ver = $change_path->relative( $version_base );
    if( $path_rel_ver->parent eq 'bin' || $path_rel_ver eq 'Resources/Python.app/Contents/MacOS/Python' ) {
      my $exec_path_rpath = File::Spec->catfile(
        '@executable_path',
        $base->relative($change_path->parent),
      );
      $build->log("-add_rpath for $change_path: $exec_path_rpath\n");
      IPC::Cmd::run( command => [
        qw(install_name_tool -add_rpath),
          $exec_path_rpath,
          $change_path
      ]); # no or die to avoid duplicate rpath bits
    }

    if( $change_path->basename =~ /\.dylib$|^Python$/ ) {

alienfile  view on Meta::CPAN

    my ($build) = @_;

    my @children = Path::Tiny->cwd->children;
    $_->remove_tree for grep { $_->basename ne 'Python_Framework.pkg' } @children;
    my $framework_src_dir = path('Python_Framework.pkg');
    my $framework_dst_dir = path('Python.framework');
    $framework_dst_dir->mkpath;
    File::Copy::Recursive::rmove( "$framework_src_dir/Payload/*", $framework_dst_dir );
    $framework_src_dir->remove_tree( { safe => 0 } );

    macos_relocatable_python($build, $framework_dst_dir->parent);
  };

  plugin 'Build::Copy';

  after build => sub {
    my($build) = @_;

    my $prefix = path($build->install_prop->{prefix});

    $build->runtime_prop->{'style'} = 'binary';



( run in 0.920 second using v1.01-cache-2.11-cpan-4d50c553e7e )