bayesiancook / pbmpi

phylobayes mpi
GNU General Public License v2.0
23 stars 9 forks source link

BioConda: ask for a release tag / -h option of PB.cpp should return a 0 exit code #4

Closed ecirtap closed 4 years ago

ecirtap commented 6 years ago

Hello,

Upon the request of a user (https://github.com/BioContainers/containers/issues/162), we would like to produce a BioConda package of pbmpi, which will facilitate later the creation of a Singularity (bio)container.

Ref:

To do that, we just need a release tag (v1.0.0) of your current master branch, and we also need that your -h option of PB.cpp return a 0 exit code instead of 1 (-h options are most of the time used to make post packaging smoke test).

Here is a patch proposal:

diff --git a/sources/PB.cpp b/sources/PB.cpp
index 480d994..b36458c 100644
--- a/sources/PB.cpp
+++ b/sources/PB.cpp
@@ -85,6 +85,8 @@ int main(int argc, char* argv[])      {

        int topoburnin = 0;

+       bool help = false;
+
        try     {

                if (argc == 1)  {
@@ -104,6 +106,7 @@ int main(int argc, char* argv[])    {
                                exit(1);
                        }
                        else if ((s == "-h") || (s == "--help"))        {
+                               help = true;
                                throw(0);
                        }
                        else if (s == "-f")     {
@@ -463,7 +466,11 @@ int main(int argc, char* argv[])   {

                }
                MPI_Finalize();
-               exit(1);
+               if (help) {
+                       exit(0);
+               } else {
+                       exit(1);
+               }
        }

        if ((modeltype == -1) && (mixturetype == -1))   {

Is it OK for you ?

Best

Patrice

bayesiancook commented 4 years ago

sorry for the slow reply

I have tagged the current version (has been stable for ~ 1 year) -- and exits with 0 upon calling with -h