Browse Source

Add a setup.py file

Phyks (Lucas Verney) 4 years ago
parent
commit
9052cfc521
No known key found for this signature in database
3 changed files with 47 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 3
    0
      lircweb/__init__.py
  3. 41
    0
      setup.py

+ 3
- 0
.gitignore View File

@@ -1,2 +1,5 @@
1 1
 *.pyc
2 2
 macros/
3
+build
4
+dist
5
+*.egg-info

+ 3
- 0
lircweb/__init__.py View File

@@ -0,0 +1,3 @@
1
+from __future__ import unicode_literals
2
+
3
+__VERSION__ = "0.1"

+ 41
- 0
setup.py View File

@@ -0,0 +1,41 @@
1
+#!/usr/bin/env python
2
+
3
+try:
4
+    from setuptools import setup
5
+except ImportError:
6
+    print('[lircweb] setuptools not found.')
7
+    raise
8
+
9
+with open('lircweb/__init__.py') as fh:
10
+    for line in fh:
11
+        line = line.strip()
12
+        if line.startswith('__VERSION__'):
13
+            version = line.split()[-1][1:-1]
14
+            break
15
+
16
+try:
17
+    from pip.req import parse_requirements
18
+    from pip.download import PipSession
19
+except ImportError:
20
+    print('[lircweb] pip not found.')
21
+    raise
22
+
23
+# parse_requirements() returns generator of pip.req.InstallRequirement objects
24
+parsed_requirements = parse_requirements("requirements.txt",
25
+                                         session=PipSession())
26
+
27
+# reqs is a list of requirement
28
+# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
29
+install_requires = [str(ir.req) for ir in parsed_requirements]
30
+
31
+setup(
32
+    name='lircweb',
33
+    version=version,
34
+    url='https://git.phyks.me/Phyks/lircweb',
35
+    author='Phyks (Lucas Verney)',
36
+    author_email='phyks@phyks.me',
37
+    license='MIT License',
38
+    description='Some code to run macros based on LIRC, from the Web.',
39
+    packages=['lircweb'],
40
+    install_requires=install_requires
41
+)