10000 Fixed bugs in set_version.py by mjcaley · Pull Request #277 · mjcaley/aiospamc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed bugs in set_version.py #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions utils/set_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, project_path: Path):

def edit(self, line, new_version):
logging.debug('File: %s; Line: %s', str(self.filename), line)
if re.match(r"^__version__[ \t]*=[ \t]*'\d+\.\d+\.\d+'", line):
if re.match(r'^__version__[ \t]*=[ \t]*"\d+\.\d+\.\d+"', line):
logging.info('Match found for %s', str(self.filename))
new_line = re.sub(r'\d+\.\d+\.\d+', new_version, line)

Expand Down Expand Up @@ -92,14 +92,18 @@ def edit(self, line, new_version):


def main():
logging.basicConfig(level=logging.INFO, format='{message}', style='{')

parser = argparse.ArgumentParser(description='Increment project version')
parser.add_argument('VERSION', help='Version string to write.')
parser.add_argument('-p', '--path', default='.', help='Path to the root of the project.')
parser.add_argument('-v', '--verbose', default=False, help='Enable debug logging.')
parser.add_argument('-v', '--verbose', action='store_const', const=True, default=False, help='Enable debug logging.')
args = parser.parse_args()

if args.verbose is True:
log_level = logging.DEBUG
else:
log_level = logging.INFO
logging.basicConfig(level=log_level, format='{message}', style='{')

project_path = Path(args.path).resolve()
if not project_path.exists():
logging.error('Could not find project path at: %s', str(project_path))
Expand Down
0