Skip to content

Commit

Permalink
- correction of README.md
Browse files Browse the repository at this point in the history
- correction of setup.py: __version__ could not be imported because the module is not available before installation
- adopted __author__ string
- small modification in test_dmx.py
  • Loading branch information
monzelr committed Nov 23, 2021
1 parent f97fbf0 commit 7689b19
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 11 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ Should also work on Linux, MacOS and on AARCH64 devices (ARM devices like Raspbe

Installation
------------
Make sure to have git, python and pip in your environment path or activate your python environment before this code snippet:
Make sure to have git, python and pip in your environment path or activate your python environment.\
To install enter in cmd/shell:

git clone https://github.com/monzelr/dmx.git

cd dmx

pip install dmx
pip install .

Alternative with python:

python setup.py install

Example Code Snippets
---------------------
Expand Down
2 changes: 1 addition & 1 deletion dmx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dmx.dmx import DEVICE_LIST
from dmx.dmx import sleep_us

__author__ = """Rune Monzel"""
__author__ = 'Rune Monzel'
__email__ = '[email protected]'
__version__ = '0.1.0'
__all__ = ['DMX',
Expand Down
55 changes: 48 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,48 @@

import sys
import os

use_distutils = False
import io
import os
import re

from setuptools import setup

# information by the package provider
from dmx import __version__ as version
from dmx import __author__ as author
from dmx import __email__ as author_email
def read(*names, **kwargs):
"""Python 2 and Python 3 compatible text file reading.
Required for single-sourcing the version string.
"""
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
return fp.read()

def find_version_author_email(*file_paths):
"""
Search the file for a specific string.
file_path contain string path components.
Reads the supplied Python module as text without importing it.
"""
_version = _author = _email = ""
file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", file, re.M)
author_match = re.search(r"^__author__ = ['\"]([^'\"]*)['\"]", file, re.M)
email_match = re.search(r"^__email__ = ['\"]([^'\"]*)['\"]", file, re.M)
if version_match:
_version = version_match.group(1)
else:
raise RuntimeError("Unable to find version string.")
if author_match:
_author = author_match.group(1)
else:
raise RuntimeError("Unable to find version string.")
if email_match:
_email = email_match.group(1)
else:
raise RuntimeError("Unable to find version string.")
return _version, _author, _email

version, author, author_email = find_version_author_email('dmx', '__init__.py')

# this is only necessary when not using setuptools/distribute
from sphinx.setup_command import BuildDoc
Expand All @@ -28,7 +61,15 @@
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
]
description = "A python module to control one DMX Universe with a USB to RS-485 adapter."
install_requires = requirements
Expand All @@ -48,7 +89,7 @@
install_requires=requirements,
keywords=keywords,
name=name,
packages=['dmx', os.path.join('dmx',"documentation")],
packages=['dmx'],
cmdclass={'build_sphinx': BuildDoc},
test_suite=test_suite,
tests_require=test_requirements,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_dmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def setUpClass(cls):
:return:
"""


def setUp(self):
"""Set up test fixtures, if any."""

Expand All @@ -30,7 +31,7 @@ def tearDownClass(cls):
"""Tear down test fixtures, if any."""
cls.disconnect()

def test_nothing(self):
def test_DMX_(self):
"""Test dmx with numpy array"""
pass

Expand Down

0 comments on commit 7689b19

Please sign in to comment.