Changeset 2598 in ProjectBuilder


Ignore:
Timestamp:
Apr 3, 2020, 8:48:30 PM (4 years ago)
Author:
Bruno Cornec
Message:

Only use ProjectBuilder::YAML when not in setupv

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 0.15.3/pb-modules/lib/ProjectBuilder/Conf.pm

    r2510 r2598  
    176176        YAML::XS->import();
    177177    };
    178     if ($@) {
    179         eval {
    180             require YAML;
    181             YAML->import();
    182         };
    183         if ($@) {
    184             eval {
    185                 # No YAML found using a more std but less complete one. Old perl only
    186                 require Module::Build::YAML;
    187                 Module::Build::YAML->import();
    188             };
    189             if ($@) {
    190                 eval {
    191                     # No YAML found using a more std but less complete one. Old perl only
    192                     require YAML::Tiny;
    193                     YAML::Tiny->import();
    194                 };
    195                 if ($@) {
    196                     # Here we should be in the setup phase, with an embedded YAML code
    197                     $dpfunc = \&pb_Dump;
     178    if ($@) {
     179        eval {
     180            require YAML;
     181            YAML->import();
     182        };
     183        if ($@) {
     184            eval {
     185                # No YAML found using a more std but less complete one. Old perl only
     186                require Module::Build::YAML;
     187                Module::Build::YAML->import();
     188            };
     189            if ($@) {
     190                eval {
     191                    # No YAML found using a more std but less complete one. Old perl only
     192                    require YAML::Tiny;
     193                    YAML::Tiny->import();
     194                };
     195                if ($@) {
     196                    # Here we use an embedded YAML code for distro lacking any YAML module
     197                    if (not defined ($ENV{'PBSETUPV'})) {
     198                        # Don't do that for setupv only for other scripts
     199                        # as the module is already embedded and would conflict
     200                        require ProjectBuilder::YAML;
     201                        ProjectBuilder::YAML->import();
     202                    };
     203                    $dpfunc = \&pb_Dump;
    198204                    $ldfunc = \&pb_LoadFile;
    199                     #die "Unable to handle YAML configuration files without a YAML.pm module\n";
    200                 } else {
    201                     $dpfunc = \&YAML::Tiny::Dump;
     205                } else {
     206                    $dpfunc = \&YAML::Tiny::Dump;
    202207                    $ldfunc = \&YAML::Tiny::LoadFile;
    203                 }
    204             } else {
    205                 $dpfunc = \&Module::Build::YAML::Dump;
     208                }
     209            } else {
     210                $dpfunc = \&Module::Build::YAML::Dump;
    206211                $ldfunc = \&Module::Build::YAML::LoadFile;
    207             }
    208         } else {
    209             $dpfunc = \&YAML::Dump;
     212            }
     213        } else {
     214            $dpfunc = \&YAML::Dump;
    210215            $ldfunc = \&YAML::LoadFile;
    211         }
    212     } else {
    213         $dpfunc = \&YAML::XS::Dump;
     216        }
     217    } else {
     218        $dpfunc = \&YAML::XS::Dump;
    214219        $ldfunc = \&YAML::XS::LoadFile;
    215     }
     220    }
    216221}
    217222}
  • 0.15.3/pb-modules/lib/ProjectBuilder/YAML.pm

    r2597 r2598  
    160160    my $self   = [];
    161161    my $string = $_[0];
    162     print("string var: $string\n");
     162    #print("string var: $string\n");
    163163    eval {
    164164        unless ( defined $string ) {
  • 0.15.3/pb/bin/pb

    r2502 r2598  
    38873887$ppref \$pblocale = "";
    38883888$ppref \$PBCONFVER = $projectbuilderconfver;
     3889$ppref \$ENV{'PBSETUPV'} = 1;
    38893890EOF
    38903891    print SCRIPT << 'EOF';
     
    42644265                    next if (/^use ProjectBuilder::/);
    42654266                    next if (/^1;$/);
    4266                     # Remove lines with our except for the strerr var in YAML
     4267                    # Remove lines with our except for the errstr var in YAML
    42674268                    next if ((/^our /) && ($_ !~ /errstr/));
    42684269                    print SCRIPT $_;
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2510 r2598  
    176176        YAML::XS->import();
    177177    };
    178     if ($@) {
    179         eval {
    180             require YAML;
    181             YAML->import();
    182         };
    183         if ($@) {
    184             eval {
    185                 # No YAML found using a more std but less complete one. Old perl only
    186                 require Module::Build::YAML;
    187                 Module::Build::YAML->import();
    188             };
    189             if ($@) {
    190                 eval {
    191                     # No YAML found using a more std but less complete one. Old perl only
    192                     require YAML::Tiny;
    193                     YAML::Tiny->import();
    194                 };
    195                 if ($@) {
    196                     # Here we should be in the setup phase, with an embedded YAML code
    197                     $dpfunc = \&pb_Dump;
     178    if ($@) {
     179        eval {
     180            require YAML;
     181            YAML->import();
     182        };
     183        if ($@) {
     184            eval {
     185                # No YAML found using a more std but less complete one. Old perl only
     186                require Module::Build::YAML;
     187                Module::Build::YAML->import();
     188            };
     189            if ($@) {
     190                eval {
     191                    # No YAML found using a more std but less complete one. Old perl only
     192                    require YAML::Tiny;
     193                    YAML::Tiny->import();
     194                };
     195                if ($@) {
     196                    # Here we use an embedded YAML code for distro lacking any YAML module
     197                    if (not defined ($ENV{'PBSETUPV'})) {
     198                        # Don't do that for setupv only for other scripts
     199                        # as the module is already embedded and would conflict
     200                        require ProjectBuilder::YAML;
     201                        ProjectBuilder::YAML->import();
     202                    };
     203                    $dpfunc = \&pb_Dump;
    198204                    $ldfunc = \&pb_LoadFile;
    199                     #die "Unable to handle YAML configuration files without a YAML.pm module\n";
    200                 } else {
    201                     $dpfunc = \&YAML::Tiny::Dump;
     205                } else {
     206                    $dpfunc = \&YAML::Tiny::Dump;
    202207                    $ldfunc = \&YAML::Tiny::LoadFile;
    203                 }
    204             } else {
    205                 $dpfunc = \&Module::Build::YAML::Dump;
     208                }
     209            } else {
     210                $dpfunc = \&Module::Build::YAML::Dump;
    206211                $ldfunc = \&Module::Build::YAML::LoadFile;
    207             }
    208         } else {
    209             $dpfunc = \&YAML::Dump;
     212            }
     213        } else {
     214            $dpfunc = \&YAML::Dump;
    210215            $ldfunc = \&YAML::LoadFile;
    211         }
    212     } else {
    213         $dpfunc = \&YAML::XS::Dump;
     216        }
     217    } else {
     218        $dpfunc = \&YAML::XS::Dump;
    214219        $ldfunc = \&YAML::XS::LoadFile;
    215     }
     220    }
    216221}
    217222}
  • devel/pb-modules/lib/ProjectBuilder/YAML.pm

    r2597 r2598  
    160160    my $self   = [];
    161161    my $string = $_[0];
    162     print("string var: $string\n");
     162    #print("string var: $string\n");
    163163    eval {
    164164        unless ( defined $string ) {
  • devel/pb/bin/pb

    r2502 r2598  
    38873887$ppref \$pblocale = "";
    38883888$ppref \$PBCONFVER = $projectbuilderconfver;
     3889$ppref \$ENV{'PBSETUPV'} = 1;
    38893890EOF
    38903891    print SCRIPT << 'EOF';
     
    42644265                    next if (/^use ProjectBuilder::/);
    42654266                    next if (/^1;$/);
    4266                     # Remove lines with our except for the strerr var in YAML
     4267                    # Remove lines with our except for the errstr var in YAML
    42674268                    next if ((/^our /) && ($_ !~ /errstr/));
    42684269                    print SCRIPT $_;
Note: See TracChangeset for help on using the changeset viewer.