Skip to content

Commit

Permalink
improved packaging in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pklaus committed Aug 25, 2017
1 parent 519c4ea commit 7210bec
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
# -*- coding: utf-8 -*-

"""
Universal Python Interface For Different USBTMC Backends.
Github: https://github.com/pklaus/universal_usbtmc
Copyright (c) 2015, Philipp Klaus. All rights reserved.
Copyright (c) 2015-2017, Philipp Klaus. All rights reserved.
"""

from setuptools import setup
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

desc = __doc__.split('\n\n')[0]
ldesc = '\n\n'.join(__doc__.split('\n\n')[1:-1])
try:
import pypandoc
tmp_txt = open('README.md', 'r').read()
ldesc += '\n\n' + pypandoc.convert(tmp_txt, 'rst', format='md')
except (ImportError, IOError, RuntimeError):
pass
# for PyPI: Removing images with relative paths and their descriptions:
import re
LDESC = open('README.md', 'r').read()
matches = re.findall(r'\n\n(.*(\n.+)*:\n\n!\[.*\]\((.*\))(\n\n)?)', LDESC)
for match in matches:
text, _, link, _ = match
if text.startswith('http://'): continue
LDESC = LDESC.replace(text, '')
# Converting to rst
LDESC = pypandoc.convert(LDESC, 'rst', format='md')
except (ImportError, IOError, RuntimeError) as e:
print("Could not create long description:")
print(str(e))
LDESC = ''

setup(name='universal_usbtmc',
version = '0.3-dev',
description = desc,
long_description = ldesc,
description = "Universal Python Interface For Different USBTMC Backends",
long_description = LDESC,
author = 'Philipp Klaus',
author_email = 'philipp.l.klaus@web.de',
url = 'https://github.com/pklaus/universal_usbtmc',
Expand All @@ -34,6 +41,7 @@
],
},
zip_safe = True,
include_package_data = True,
platforms = 'any',
keywords = 'USBTMC',
classifiers = [
Expand Down

0 comments on commit 7210bec

Please sign in to comment.