esm-tools / esm_master

GNU General Public License v2.0
2 stars 2 forks source link

Hotfix/recomp standalone bin #18

Closed mandresm closed 4 years ago

mandresm commented 4 years ago

This solves a problem in issue esm-tools/esm_tools#77.

Recompilation of ECHAM was successful, but if a binary existed in the bin folder (i.e. echam-6.3.04p1/bin/echam6), the following lines will find it out and avoid entering in the if that builds the command for copying the binary from the src to the bin folder:

                            toplevel_bin_path = (
                                toplevel + "/"
                                + task.package.bin_type + "/"
                                + binfile.split("/")[-1]
                            )
                            if not os.path.exists(toplevel_bin_path):
                                command_list.append(
                                    "cp "
                                    + task.package.destination
                                    + "/"
                                    + binfile
                                    + " "
                                    + toplevel
                                    + "/"
                                    + task.package.bin_type
                                )
                                real_command_list.append(
                                    "cp "
                                    + task.package.destination
                                    + "/"
                                    + binfile
                                    + " "
                                    + toplevel
                                    + "/"
                                    + task.package.bin_type
                                )

This was solved by checking if there is already a rm -f command in the command_list and, if that exists, it means that the toplevel_bin_path file is going to be deleted and and the if that copies the binary is allowed.