Skip to content

Commit

Permalink
[py wrapper] augment setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jul 22, 2021
1 parent 9926e15 commit 58c69b3
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions RPi/pyRF24Network/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python

import os
from setuptools import setup, Extension
from sys import version_info

Expand All @@ -8,10 +8,37 @@
else:
BOOST_LIB = "boost_python"

# NOTE current repo directory structure requires the use of
# `python3 setup.py build` and `python3 setup.py install`
# where `pip3 install ./pyRF24` copies pyRF24 directory to
# `tmp` folder that doesn't have the needed `../Makefile.inc`
# NOTE can't access "../Makefile.inc" from working dir because
# it's relative. Brute force absolute path dynamically.
git_dir = os.path.split(os.path.abspath(os.getcwd()))[0]
git_dir = os.path.split(git_dir)[0] # remove the "RPi" dir from working path

# get LIB_VERSION from library.properties file for Arduino IDE
version = "1.0"
with open(os.path.join(git_dir, "library.properties"), "r") as f:
for line in f.read().splitlines():
if line.startswith("version"):
version = line.split("=")[1]


long_description = """
.. warning:: This python wrapper for the RF24Network C++ library was not intended
for distribution on pypi.org. If you're reading this, then this package
is likely unauthorized or unofficial.
"""


setup(
name="RF24Network",
version="1.0",
classifiers = [
version=version,
license_files=os.path.join(git_dir, "LICENSE"),
long_description=long_description,
long_description_content_type="text/x-rst",
classifiers=[
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Programming Language :: C++",
Expand All @@ -20,8 +47,8 @@
ext_modules=[
Extension(
"RF24Network",
libraries = ["rf24network", BOOST_LIB],
sources=["pyRF24Network.cpp"]
sources=["pyRF24Network.cpp"],
libraries=["rf24", "rf24network", BOOST_LIB],
)
]
],
)

0 comments on commit 58c69b3

Please sign in to comment.