-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
75 lines (67 loc) · 2.23 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import sys
import setuptools
import distutils.core
import os.path
# Grab the library location from the command line
libdir = None
for argument in sys.argv:
if argument.startswith('--libdir='):
libdir = argument
if libdir is None:
print('Need to specify location of liblame')
sys.exit(1)
sys.argv.remove(libdir)
libdir = libdir[len('--libdir='):]
# Grab the include location from the command line
incdir = None
for argument in sys.argv:
if argument.startswith('--incdir='):
incdir = argument
if incdir is None:
print('Need to specify location of liblame source')
sys.exit(1)
sys.argv.remove(incdir)
incdir = incdir[len('--incdir='):]
# Create the extension
lameenc = distutils.core.Extension(
'lameenc',
include_dirs=[incdir],
libraries=['libmp3lame'] if sys.platform == 'win32' else [],
extra_objects=
[] if sys.platform == 'win32' else [os.path.join(libdir, 'libmp3lame.a')],
library_dirs=[libdir] if sys.platform == 'win32' else [],
sources=['lameenc.c']
)
configuration = dict(
name='lameenc',
description='LAME encoding bindings',
long_description='''
Python 3 bindings for the LAME encoding library.
This library makes it simple to encode PCM data into MP3 without having
to compile any binaries.
Provides binaries in PyPi for Python 3.8+ for Windows, macOS and Linux.
''',
author='Chris Staite',
author_email='[email protected]',
url='https://github.com/chrisstaite/lameenc',
license='LGPLv3',
ext_modules=[lameenc],
classifiers=[
'Topic :: Multimedia :: Sound/Audio :: Conversion',
'Programming Language :: Python :: 3 :: Only',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux'
]
)
if os.path.exists(os.path.join(os.path.abspath(os.path.dirname(__file__)), '.git')):
configuration['setup_requires'] = ['setuptools-git-versioning']
configuration['setuptools_git_versioning'] = {
'enabled': True,
'starting_version': '1.7.0'
}
else:
configuration['version'] = '1.7.0'
# Create the package
setuptools.setup(**configuration)