old_contents: import os
  import unittest
  from setuptools import setup, find_packages
  from pprint import pformat
  base_dir = os.path.dirname(os.path.abspath(__file__))
  
  import gpiozero
  from gpiozero.pins.mock import MockPin
  
  gpiozero.devices.pin_factory = MockPin
  
  from picraftzero.version import version
  
  install_requires = ['gpiozero']       # optional: #cap1xxx==0.1.3 evdev==0.6.4x
  tests_require = ['selenium']
  
  
  def test_suite():
      test_loader = unittest.TestLoader()
      test_suite = test_loader.discover('test')
      return test_suite
  
  
  
  setup(
      name='picraftzero',
      version=version,
      description="A library for building universal controls for robots",
      #long_description="\n\n".join([
      #    open(os.path.join(base_dir, "README.md"), "r").read(),
      #]),
      long_description="PiCraftZero, universal robot remote controls and viewer",
      url='https://www.thebubbleworks.com/picraftzero',
      author='Wayne Keenan',
      author_email='wayne@thebubbleworks.com',
      maintainer='Wayne Keenan',
      maintainer_email='wayne@thebubbleworks.com',
      license='MIT',
      packages=find_packages(),
      include_package_data=True,
      #package_data={'picraftzero': ['picraftzero.cfg']},
      zip_safe=False,
      install_requires=install_requires,
      tests_require=tests_require,
      test_suite="setup.test_suite",
      platforms=['Raspberry Pi', 'Linux', 'Mac'],
      # https://pypi.python.org/pypi?%3Aaction=list_classifiers
      classifiers=['Development Status :: 4 - Beta',
                   'Programming Language :: Python :: 3',
                   'Environment :: Console',
                   'Environment :: Web Environment',
                   'Intended Audience :: End Users/Desktop',
                   'Intended Audience :: Developers',
                   'Operating System :: MacOS :: MacOS X',
                   'Operating System :: POSIX',
                   'Topic :: Software Development :: Libraries :: Python Modules',
                   ],
  )
  
new_contents: import os
  import re, os
  import unittest
  from setuptools import setup, find_packages
  
  base_dir = os.path.dirname(os.path.abspath(__file__))
  version_file=os.path.join(base_dir, "picraftzero", "version.py")
  with open(version_file, "rt") as f:
      verstrline = f.read()
      vsre = r"^version = ['\"]([^'\"]*)['\"]"
      mo = re.search(vsre, verstrline, re.M)
      if mo:
          __version__ = mo.group(1)
      else:
          raise RuntimeError("Unable to find version string in %s." % (version_file,))
  
  
  install_requires = ['gpiozero']       # optional: #cap1xxx==0.1.3 evdev==0.6.4x
  tests_require = ['selenium']
  
  
  def test_suite():
      test_loader = unittest.TestLoader()
      test_suite = test_loader.discover('test')
      return test_suite
  
  
  
  setup(
      name='picraftzero',
      version=__version__ ,
      description="A library for building universal controls for robots",
      #long_description="\n\n".join([
      #    open(os.path.join(base_dir, "README.md"), "r").read(),
      #]),
      long_description="PiCraftZero, universal robot remote controls and viewer",
      url='https://www.thebubbleworks.com/picraftzero',
      author='Wayne Keenan',
      author_email='wayne@thebubbleworks.com',
      maintainer='Wayne Keenan',
      maintainer_email='wayne@thebubbleworks.com',
      license='MIT',
      packages=find_packages(),
      include_package_data=True,
      #package_data={'picraftzero': ['picraftzero.cfg']},
      zip_safe=False,
      install_requires=install_requires,
      tests_require=tests_require,
      test_suite="setup.test_suite",
      platforms=['Raspberry Pi', 'Linux', 'Mac'],
      # https://pypi.python.org/pypi?%3Aaction=list_classifiers
      classifiers=['Development Status :: 4 - Beta',
                   'Programming Language :: Python :: 3',
                   'Environment :: Console',
                   'Environment :: Web Environment',
                   'Intended Audience :: End Users/Desktop',
                   'Intended Audience :: Developers',
                   'Operating System :: MacOS :: MacOS X',
                   'Operating System :: POSIX',
                   'Topic :: Software Development :: Libraries :: Python Modules',
                   ],
  )
  
subject: stop setup.py importing spurious modules and parse version directly