Skip to content

A better way than subprocess #5

@underwoo

Description

@underwoo

Currently ocean_grid_generator.py uses subprocess to get the script location, and check the git information. Below is a better way to get that information. Consider updating.

scriptpath = os.path.realpath(__file__)
scriptbasename = os.path.basename(scriptpath)
scriptdirname = os.path.dirname(scriptpath)
scriptgithash = subprocess.check_output(['git', 'rev-parse', 'HEAD'],
                                        cwd=scriptdirname)
scriptgithash = scriptgithash.decode('ascii').rstrip("\n")
scriptgitMod = subprocess.check_output(['git', 'status', '--porcelain',
                                        scriptbasename],
                                       cwd=scriptdirname)
scriptgitMod = scriptgitMod.decode('ascii').rstrip("\n")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions