GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix incorrect parsing of __version__ property · alliedvision/VimbaPython@06c0e13

This repository was archived by the owner on Apr 18, 2024. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • setup.py
  • vimba
    • __init__.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎setup.py‎

Copy file name to clipboardExpand all lines: setup.py
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,17 @@
2727

2828
import setuptools
2929
import os
30+
import re
3031

3132
def read_file(name):
32-
print(name)
3333
with open(file=name, mode='r', encoding='utf-8') as file:
3434
return file.read()
3535

3636

3737
def get_version(file_content):
38-
print(file_content)
39-
for line in file_content.splitlines():
40-
line = line.strip()
41-
42-
if line.startswith('__version__'):
43-
_, val = line.split('=')
44-
45-
return val.strip()
46-
47-
raise RuntimeError('Unable to extract __version__.')
48-
38+
result = re.search(r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format('__version__'),
39+
file_content)
40+
return result.group(1)
4941

5042
name = 'VimbaPython'
5143
version = get_version(read_file(os.path.join('.', 'vimba', '__init__.py')))
Collapse file

‎vimba/__init__.py‎

Copy file name to clipboardExpand all lines: vimba/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# Suppress 'imported but unused' - Error from static style checker.
3434
# flake8: noqa: F401
3535

36-
__version__ = '0.3.0'
36+
__version__ = '0.3.1'
3737

3838
__all__ = [
3939
'Vimba',

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.