|
| 1 | +#!/usr/bin/env python |
1 | 2 | from os.path import join
|
2 |
| -from setuptools import setup, find_packages |
3 |
| -import sys |
4 |
| -import os |
| 3 | +from setuptools import setup |
5 | 4 |
|
6 |
| -def read(fname): |
7 |
| - with open(os.path.join(os.path.dirname(__file__), fname)) as f: |
8 |
| - return f.read() |
9 | 5 |
|
10 | 6 | def get_version():
|
11 |
| - with open(join('tinytag', '__init__.py')) as f: |
12 |
| - for line in f: |
13 |
| - if line.startswith('__version__ ='): |
14 |
| - return line.split('=')[1].strip().strip('"\'') |
| 7 | + with open(join("tinytag", "__init__.py")) as f: |
| 8 | + version_line = next(line for line in f if line.startswith("__version__ =")) |
| 9 | + return version_line.split("=")[1].strip().strip("\"'") |
15 | 10 |
|
16 |
| -long_description = None |
17 |
| -if 'upload' in sys.argv or 'register' in sys.argv: |
18 |
| - readmemd = "\n" + "\n".join([read('README.md')]) |
19 |
| - print("converting markdown to reStucturedText for upload to pypi.") |
20 |
| - from urllib.request import urlopen |
21 |
| - from urllib.parse import quote |
22 |
| - import json |
23 |
| - import codecs |
24 |
| - url = 'http://pandoc.org/cgi-bin/trypandoc?from=markdown&to=rst&text=%s' |
25 |
| - urlhandler = urlopen(url % quote(readmemd)) |
26 |
| - result = json.loads(codecs.decode(urlhandler.read(), 'utf-8')) |
27 |
| - long_description = result['html'] |
28 |
| -else: |
29 |
| - long_description = "\n" + "\n".join([read('README.md')]) |
30 | 11 |
|
31 |
| -setup( |
32 |
| - name='tinytag', |
33 |
| - version=get_version(), |
34 |
| - description='Read music meta data and length of MP3, OGG, OPUS, MP4, M4A, FLAC, WMA and Wave files', |
35 |
| - long_description=long_description, |
36 |
| - long_description_content_type='text/markdown', |
37 |
| - author='Tom Wallroth', |
38 |
| - |
39 |
| - url='https://github.com/devsnd/tinytag/', |
40 |
| - license='MIT', |
41 |
| - packages=find_packages(), |
42 |
| - install_requires=[], |
43 |
| - classifiers=[ |
44 |
| - 'Programming Language :: Python', |
45 |
| - 'Programming Language :: Python :: 2.6', |
46 |
| - 'Programming Language :: Python :: 2.7', |
47 |
| - 'Programming Language :: Python :: 3', |
48 |
| - 'Programming Language :: Python :: 3.2', |
49 |
| - 'Programming Language :: Python :: 3.3', |
50 |
| - 'Programming Language :: Python :: 3.4', |
51 |
| - 'Programming Language :: Python :: 3.5', |
52 |
| - 'Programming Language :: Python :: 3.6', |
53 |
| - 'License :: OSI Approved :: MIT License', |
54 |
| - 'Development Status :: 5 - Production/Stable', |
55 |
| - 'Environment :: Web Environment', |
56 |
| - 'Intended Audience :: Developers', |
57 |
| - 'Operating System :: OS Independent', |
58 |
| - 'Topic :: Internet :: WWW/HTTP', |
59 |
| - 'Topic :: Multimedia', |
60 |
| - 'Topic :: Multimedia :: Sound/Audio', |
61 |
| - 'Topic :: Multimedia :: Sound/Audio :: Analysis', |
62 |
| - ], |
63 |
| - zip_safe=False, |
64 |
| - tests_require=["nose"], |
65 |
| -) |
| 12 | +setup(version=get_version()) |
0 commit comments