Skip to content

Commit ffb20b5

Browse files
committed
add setup script
1 parent f8441c1 commit ffb20b5

File tree

6 files changed

+81
-0
lines changed

6 files changed

+81
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.pyc
2+
build
3+
*.egg-info
4+
dist

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include requirements.txt
2+
include README.md

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
socos
2+
=====
3+
4+
socos (Sonos Controller Shell) is a commandline tools for controlling Sonos
5+
speakers.

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
soco==0.6

setup.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
3+
try:
4+
from setuptools import setup
5+
has_setuptools = True
6+
except ImportError:
7+
from distutils.core import setup
8+
has_setuptools = False
9+
10+
import re
11+
import os.path
12+
13+
dirname = os.path.dirname(os.path.abspath(__file__))
14+
filename = os.path.join(dirname, 'socos.py')
15+
src = open(filename).read()
16+
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", src))
17+
docstrings = re.findall('"""(.*)"""', src)
18+
19+
PACKAGE = 'socos'
20+
21+
MODULES = (
22+
'socos',
23+
)
24+
25+
AUTHOR_EMAIL = metadata['author']
26+
VERSION = metadata['version']
27+
WEBSITE = metadata['website']
28+
LICENSE = metadata['license']
29+
DESCRIPTION = docstrings[0]
30+
31+
REQUIREMENTS = list(open('requirements.txt'))
32+
33+
OPTIONS = {}
34+
35+
if has_setuptools:
36+
OPTIONS = {
37+
'install_requires': REQUIREMENTS,
38+
}
39+
40+
# Extract name and e-mail ("Firstname Lastname <mail@example.org>")
41+
AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups()
42+
43+
setup(name=PACKAGE,
44+
version=VERSION,
45+
description=DESCRIPTION,
46+
author=AUTHOR,
47+
author_email=EMAIL,
48+
license=LICENSE,
49+
url=WEBSITE,
50+
py_modules=MODULES,
51+
scripts=['bin/socos'],
52+
entry_points={
53+
'console_scripts': [
54+
'socos = socos:main',
55+
]
56+
},
57+
**OPTIONS
58+
)

socos.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/usr/bin/env python
22

33
from __future__ import print_function
4+
5+
6+
""" socos is a commandline tool for controlling Sonos speakers """
7+
8+
# Will be parsed by setup.py to determine package metadata
9+
__author__ = 'SoCo team <python-soco @googlegroups.com>'
10+
__version__ = '0.1'
11+
__website__ = 'https://github.com/SoCo/socos'
12+
__license__ = 'MIT License'
13+
14+
415
import sys
516
try:
617
import colorama

0 commit comments

Comments
 (0)