Skip to content

Commit

Permalink
[FEATURE] added basic setup.py stub
Browse files Browse the repository at this point in the history
  • Loading branch information
reactive-firewall committed Dec 15, 2021
1 parent b93f1a6 commit 3bea4e8
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 13 deletions.
36 changes: 25 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ifeq "$(MAKE)" ""
MAKE=make
endif

ifeq "$(PYTHON)" ""
PYTHON=export LC_CTYPE="en_US.utf-8" ; python3 -B
endif

ifeq "$(WAIT)" ""
WAIT=wait
endif
Expand Down Expand Up @@ -58,18 +62,20 @@ endif
PHONY: must_be_root cleanup

build:
$(QUIET)$(ECHO) "No need to build. Try make -f Makefile install"
$(QUIET)$(ECHO) "INFO: No need to build. Try make -f Makefile install"
$(QUIET)$(PYTHON) ./setup.py build
$(QUIET)$(ECHO) "build DONE."

init:
$(QUIET)$(ECHO) "$@: Done."

install: must_be_root
$(QUIET)python3 -m pip install "git+https://github.com/reactive-firewall/multicast.git#egg=multicast"
$(QUIET)$(PYTHON) -m pip install "git+https://github.com/reactive-firewall/multicast.git#egg=multicast"
$(QUITE)$(WAIT)
$(QUIET)$(ECHO) "$@: Done."

uninstall:
$(QUITE)python3 -m pip uninstall multicast || true
$(QUITE)$(PYTHON) -m pip uninstall multicast || true
$(QUITE)$(WAIT)
$(QUIET)$(ECHO) "$@: Done."

Expand All @@ -78,11 +84,13 @@ test-reports:
$(QUIET)$(ECHO) "$@: Done."

purge: clean uninstall
$(QUIET)python3 -m pip uninstall multicast && python -m pip uninstall multicast || true
$(QUIET)$(PYTHON) -m pip uninstall multicast && python -m pip uninstall multicast || true
$(QUIET)rm -Rfd ./build/ 2>/dev/null || true
$(QUIET)rm -Rfd ./.eggs/ 2>/dev/null || true
$(QUIET)$(ECHO) "$@: Done."

test: cleanup
$(QUIET)coverage run -p --source=multicast -m unittest discover --verbose -s ./tests -t ./ || python3 -m unittest discover --verbose -s ./tests -t ./ || python -m unittest discover --verbose -s ./tests -t ./ || DO_FAIL=exit 2 ;
$(QUIET)coverage run -p --source=multicast -m unittest discover --verbose -s ./tests -t ./ || $(PYTHON) -m unittest discover --verbose -s ./tests -t ./ || python -m unittest discover --verbose -s ./tests -t ./ || DO_FAIL=exit 2 ;
$(QUIET)coverage combine 2>/dev/null || true
$(QUIET)coverage report --include=multicast* 2>/dev/null || true
$(QUIET)$(DO_FAIL);
Expand All @@ -93,7 +101,7 @@ test-tox: cleanup
$(QUIET)$(ECHO) "$@: Done."

test-pytest: cleanup test-reports
$(QUIET)python3 -m pytest --junitxml=test-reports/junit.xml -v tests || python -m pytest --junitxml=test-reports/junit.xml -v tests
$(QUIET)$(PYTHON) -m pytest --junitxml=test-reports/junit.xml -v tests || python -m pytest --junitxml=test-reports/junit.xml -v tests
$(QUIET)$(ECHO) "$@: Done."

test-style: cleanup
Expand All @@ -104,19 +112,24 @@ test-style: cleanup
cleanup:
$(QUIET)rm -f tests/*.pyc 2>/dev/null || true
$(QUIET)rm -f tests/*~ 2>/dev/null || true
$(QUIET)rm -Rf tests/__pycache__ 2>/dev/null || true
$(QUIET)rm -Rfd tests/__pycache__ 2>/dev/null || true
$(QUIET)rm -f multicast/*.pyc 2>/dev/null || true
$(QUIET)rm -Rf multicast/__pycache__ 2>/dev/null || true
$(QUIET)rm -Rf multicast/*/__pycache__ 2>/dev/null || true
$(QUIET)rm -Rfd multicast/__pycache__ 2>/dev/null || true
$(QUIET)rm -Rfd multicast/*/__pycache__ 2>/dev/null || true
$(QUIET)rm -f multicast/*~ 2>/dev/null || true
$(QUIET)rm -f *.pyc 2>/dev/null || true
$(QUIET)rm -f multicast/*/*.pyc 2>/dev/null || true
$(QUIET)rm -f multicast/*/*~ 2>/dev/null || true
$(QUIET)rm -f *.DS_Store 2>/dev/null || true
$(QUIET)rm -Rf .pytest_cache/ 2>/dev/null || true
$(QUIET)rm -f ./.DS_Store 2>/dev/null || true
$(QUIET)rm -Rfd .pytest_cache/ 2>/dev/null || true
$(QUIET)rmdir ./test-reports/ 2>/dev/null || true
$(QUIET)rm -f multicast/*.DS_Store 2>/dev/null || true
$(QUIET)rm -f multicast/*/*.DS_Store 2>/dev/null || true
$(QUIET)rm -f multicast/.DS_Store 2>/dev/null || true
$(QUIET)rm -f multicast/*/.DS_Store 2>/dev/null || true
$(QUIET)rm -f tests/.DS_Store 2>/dev/null || true
$(QUIET)rm -f tests/*/.DS_Store 2>/dev/null || true
$(QUIET)rm -f multicast.egg-info/* 2>/dev/null || true
$(QUIET)rmdir multicast.egg-info 2>/dev/null || true
$(QUIET)rm -f ./*/*~ 2>/dev/null || true
Expand All @@ -126,10 +139,11 @@ cleanup:
$(QUIET)rm -f ./coverage*.xml 2>/dev/null || true
$(QUIET)rm -f ./sitecustomize.py 2>/dev/null || true
$(QUIET)rm -f ./.*~ 2>/dev/null || true
$(QUIET)rm -Rf ./.tox/ 2>/dev/null || true
$(QUIET)rm -Rfd ./.tox/ 2>/dev/null || true

clean: cleanup
$(QUIET)rm -f test-results/junit.xml 2>/dev/null || true
$(QUIET)rm -Rfd ./build/ 2>/dev/null || true
$(QUIET)$(MAKE) -s -C ./docs/ -f Makefile clean 2>/dev/null || true
$(QUIET)$(ECHO) "$@: Done."

Expand Down
15 changes: 13 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ version = 1.1.3
author = Mr. Walls
author-email = reactive-firewall@users.noreply.github.com
summary = Python multicast repo for send/recv stubs
description = file: README.md
description-file = file: README.md
long_description = file: README.md
long_description_content_type = text/markdown
home-page = https://github.com/reactive-firewall/multicast
download-url = https://github.com/reactive-firewall/multicast.git
license = file: LICENSE.md
classifiers =
License :: OSI Approved :: MIT License
Development Status :: 4 - Beta
Operating System :: POSIX :: Linux
Programming Language :: Python
Expand All @@ -19,15 +22,23 @@ classifiers =
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.5

[bdist_rpm]
url = https://www.github.com/reactive-firewall/multicast.git

[bdist_wheel]
universal=1

[files]
packages = multicast

[options]
packages = find:
py_modules = piaplib
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
packages = find:*.py
scripts =
multicast/__main__.py

[options.packages.find]
exclude =
tests

60 changes: 60 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Python Multicast Repo
# ..................................
# Copyright (c) 2017-2022, Kendrick Walls
# ..................................
# Licensed under MIT (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# ..........................................
# http://www.github.com/reactive-firewall/multicast/LICENSE.md
# ..........................................
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

try:
from setuptools import setup
from setuptools import find_packages
except Exception:
raise NotImplementedError("""Not Implemented.""")


def readFile(filename):
"""Helper Function to read files"""
theResult = None
try:
with open(str("""./{}""").format(str(filename))) as f:
theResult = f.read()
except Exception:
theResult = str(
"""See https://github.com/reactive-firewall/multicast/{}"""
).format(filename)
return theResult


try:
with open("""./requirements.txt""") as f:
requirements = f.read().splitlines()
except Exception:
requirements = None

readme = readFile("""README.md""")
SLA = readFile("""LICENSE.md""")

setup(
name="""multicast""",
version="""1.1.3""",
description="""Python Multicast Repo for Send/Recv Stubs""",
long_description=readme,
install_requires=requirements,
author="""reactive-firewall""",
author_email="""reactive-firewall@users.noreply.github.com""",
url="""https://github.com/reactive-firewall/multicast.git""",
license=SLA,
packages=find_packages(exclude=("""tests""")),
)

0 comments on commit 3bea4e8

Please sign in to comment.