# Path: pytripgui/version.py
# def git_version():
#     """
#     Inspired by https://github.com/numpy/numpy/blob/master/setup.py
#     :return: the git revision as a string
#     """
#     def _minimal_ext_cmd(cmd):
#         # construct minimal environment
#         env = {}
#         for k in ['SYSTEMROOT', 'PATH', 'HOME']:
#             v = os.environ.get(k)
#             if v is not None:
#                 env[k] = v
#         # LANGUAGE is used on win32
#         env['LANGUAGE'] = 'C'
#         env['LANG'] = 'C'
#         env['LC_ALL'] = 'C'
#         out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
#         return out
# 
#     try:
#         out = _minimal_ext_cmd(['git', 'describe', '--tags', '--long'])
#         GIT_REVISION = out.strip().decode('ascii')
#         if GIT_REVISION:
#             no_of_commits_since_last_tag = int(GIT_REVISION.split('-')[1])
#             tag_name = GIT_REVISION.split('-')[0][1:]
#             if no_of_commits_since_last_tag == 0:
#                 version = tag_name
#             else:
#                 version = '{}+rev{}'.format(tag_name, no_of_commits_since_last_tag)
#         else:
#             version = "Unknown"
#     except OSError:
#         version = "Unknown"
# 
#     return version


import os
import setuptools
from pytripgui.version import git_version
    cnt = """%(version)s
"""

    GIT_REVISION = git_version()
    a = open(filename, 'w')
    try:
        a.write(cnt % {'version': GIT_REVISION})
    finally:
        a.close()


write_version_py()

with open('README.rst') as readme_file:
    readme = readme_file.read()

# install_requires is list of dependencies needed by pip when running `pip install`
install_requires = [
    "matplotlib==3.4.3 ; python_version>='3.7'",
    'pytrip98[remote]~=3.7',
    'anytree~=2.8',
    'Events~=0.4',
    "PyQt5<5.10 ; python_version<'3.8'",
    "PyQt5>=5.15 ; python_version>='3.8'",
    "PyQtChart<5.10 ; python_version<'3.8'",
    "PyQtChart>=5.15 ; python_version>='3.8'",
]

setuptools.setup(
    name='pytrip98gui',

# Path: pytripgui/version.py
# def git_version():
#     """
#     Inspired by https://github.com/numpy/numpy/blob/master/setup.py
#     :return: the git revision as a string
#     """
#     def _minimal_ext_cmd(cmd):
#         # construct minimal environment
#         env = {}
#         for k in ['SYSTEMROOT', 'PATH', 'HOME']:
#             v = os.environ.get(k)
#             if v is not None:
#                 env[k] = v
#         # LANGUAGE is used on win32
#         env['LANGUAGE'] = 'C'
#         env['LANG'] = 'C'
#         env['LC_ALL'] = 'C'
#         out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
#         return out
# 
#     try:
#         out = _minimal_ext_cmd(['git', 'describe', '--tags', '--long'])
#         GIT_REVISION = out.strip().decode('ascii')
#         if GIT_REVISION:
#             no_of_commits_since_last_tag = int(GIT_REVISION.split('-')[1])
#             tag_name = GIT_REVISION.split('-')[0][1:]
#             if no_of_commits_since_last_tag == 0:
#                 version = tag_name
#             else:
#                 version = '{}+rev{}'.format(tag_name, no_of_commits_since_last_tag)
#         else:
#             version = "Unknown"
#     except OSError:
#         version = "Unknown"
# 
#     return version


# Path: setup.py
import os
import setuptools
from pytripgui.version import git_version

    cnt = """%(version)s
"""

    GIT_REVISION = git_version()
    a = open(filename, 'w')
    try:
        a.write(cnt % {'version': GIT_REVISION})
    finally:
        a.close()


write_version_py()

with open('README.rst') as readme_file:
    readme = readme_file.read()

# install_requires is list of dependencies needed by pip when running `pip install`
install_requires = [
    "matplotlib==3.4.3 ; python_version>='3.7'",
    'pytrip98[remote]~=3.7',
    'anytree~=2.8',
    'Events~=0.4',
    "PyQt5<5.10 ; python_version<'3.8'",
    "PyQt5>=5.15 ; python_version>='3.8'",
    "PyQtChart<5.10 ; python_version<'3.8'",
    "PyQtChart>=5.15 ; python_version>='3.8'",
]

setuptools.setup(
    name='pytrip98gui',

    version=git_version(),