Last active
October 27, 2022 18:00
-
-
Save bpgould/a6673d7377402accdb1f2da12084b36a to your computer and use it in GitHub Desktop.
bash regex to parse semver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fancy regex will parse 0.8.39, can be used to parse semver | |
VERSION_FROM_SETUP=$(sed -n 's/^ *version="\([^"]*\).*/\1/p' setup.py) | |
# example setup.py file, start multi-line comment | |
: ' | |
import setuptools | |
import os | |
setuptools.setup( | |
name="project", | |
version="0.8.39", | |
author="Tom, Nancy", | |
author_email="email@email.com", | |
description="A CI/CD Automation Platform", | |
url="https://github.com/link", | |
install_requires=[ | |
'click>=7', | |
'requests==2.21.0', | |
'pyyaml>=5.3', | |
'dependency-check==0.6.0' | |
] | |
... | |
) | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment