Commit 84e5ffa9 authored by Simon Sebastian Humpohl's avatar Simon Sebastian Humpohl
Browse files

Dynamic __version__ read

Rudimentary is simulator check
parent 1c40f0ec
from setuptools import setup
import os
import re
def get_version():
dir_path = os.path.dirname(os.path.realpath(__file__))
teawg_init = os.path.join(dir_path, 'teawg', '__init__.py')
with open(teawg_init, 'r') as version_file:
# https://packaging.python.org/guides/single-sourcing-package-version/
version_match = re.search(r"^__version__\s+=\s+['\"]([^'\"]*)['\"]", version_file.read(), re.M)
if version_match:
return version_match.group(1)
else:
raise RuntimeError("Unable to find version string.")
setup(
name='pytabor',
version='0.0.1',
version=get_version(),
packages=['pytabor', 'teawg'],
package_dir={'pytabor': 'pytabor', 'teawg': 'teawg'},
url='',
......
......@@ -37,6 +37,8 @@ import time
import posixpath
from pyvisa.errors import VisaIOError, VI_ERROR_TMO
from pyvisa.resources import TCPIPSocket
from pyvisa.constants import InterfaceType
import pytabor
......@@ -438,6 +440,13 @@ class TEWXAwg(object):
'''Get the firmware version '''
return self._fw_ver
@property
def is_simulator(self):
'''True if IP address is localhost'''
if self.visa_inst and self.visa_inst.interface_type == InterfaceType.tcpip:
return '127.0.0.1' in self.visa_inst.resource_name or 'localhost' in self.visa_inst.resource_name
return False
@property
def paranoia_level(self):
'''Get the (default) paranoia-level
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment