daemon: Use automake to install python data files.

Includes other small changes.
This commit is contained in:
tgoff0 2015-05-26 17:33:57 +00:00
parent 666efe9788
commit 0ce17e8c52
4 changed files with 87 additions and 42 deletions

View file

@ -7,32 +7,91 @@
# Makefile for building netns components. # Makefile for building netns components.
# #
PYSBINDIR = ${DESTDIR}/${pyprefix}/sbin SETUPPY = setup.py
SETUPPYFLAGS = -v
if WANT_NETNS if WANT_NETNS
SUBDIRS = src ns3 SUBDIRS = src ns3
endif endif
SBIN_FILES = \
sbin/core-cleanup \
sbin/core-daemon \
sbin/core-manage \
sbin/core-xen-cleanup \
sbin/coresendmsg
dist_sbin_SCRIPTS = $(SBIN_FILES)
CONF_FILES = \
data/core.conf \
data/xen.conf
coreconfdir = $(CORE_CONF_DIR)
dist_coreconf_DATA = $(CONF_FILES)
EXAMPLE_FILES = \
examples/controlnet_updown \
examples/emanemodel2core.py \
examples/findcore.py \
examples/stopsession.py
coreexdir = $(datadir)/core/examples
dist_coreex_DATA = $(EXAMPLE_FILES)
EXAMPLE_MYSERVICES_FILES = \
examples/myservices/README.txt \
examples/myservices/__init__.py \
examples/myservices/sample.py
coreexmyservicesdir = $(coreexdir)/myservices
dist_coreexmyservices_DATA = $(EXAMPLE_MYSERVICES_FILES)
EXAMPLE_NETNS_FILES = \
examples/netns/basicrange.py \
examples/netns/distributed.py \
examples/netns/emane80211.py \
examples/netns/howmanynodes.py \
examples/netns/iperf-performance-chain.py \
examples/netns/iperf-performance.sh \
examples/netns/ospfmanetmdrtest.py \
examples/netns/switch.py \
examples/netns/switchtest.py \
examples/netns/twonodes.sh \
examples/netns/wlanemanetests.py \
examples/netns/wlantest.py
coreexnetnsdir = $(coreexdir)/netns
dist_coreexnetns_DATA = $(EXAMPLE_NETNS_FILES)
EXAMPLE_SERVICES_FILES = \
examples/services/sampleFirewall \
examples/services/sampleIPsec \
examples/services/sampleVPNClient \
examples/services/sampleVPNServer
coreexservicesdir = $(coreexdir)/services
dist_coreexservices_DATA= $(EXAMPLE_SERVICES_FILES)
# Python package build # Python package build
noinst_SCRIPTS = build noinst_SCRIPTS = build
build: build:
$(PYTHON) setup.py build $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) build
# Python package install # Python package install
install-exec-hook: install-exec-hook:
CORE_CONF_DIR=${DESTDIR}/${CORE_CONF_DIR} $(PYTHON) setup.py install --prefix=${DESTDIR}/${pyprefix} --install-purelib=${DESTDIR}/${pythondir} --install-platlib=${DESTDIR}/${pyexecdir} --no-compile $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install --prefix=${DESTDIR}/${pyprefix} --install-purelib=${DESTDIR}/${pythondir} --install-platlib=${DESTDIR}/${pyexecdir} --no-compile
# Python package uninstall # Python package uninstall
uninstall-hook: uninstall-hook:
rm -f ${PYSBINDIR}/core-daemon
rm -f ${PYSBINDIR}/coresendmsg
rm -f ${PYSBINDIR}/core-cleanup
rm -f ${PYSBINDIR}/core-xen-cleanup
rm -f ${PYSBINDIR}/core-manage
rm -f ${pythondir}/core_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info rm -f ${pythondir}/core_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info
rm -f ${pythondir}/core_python_netns-1.0-py${PYTHON_VERSION}.egg-info rm -f ${pythondir}/core_python_netns-1.0-py${PYTHON_VERSION}.egg-info
rm -rf ${pythondir}/core rm -rf ${pythondir}/core
rm -rf ${prefix}/share/core rmdir -p $(coreexservicesdir) || true
rmdir -p $(coreexnetnsdir) || true
rmdir -p $(coreexmyservicesdir) || true
rmdir -p $(coreexdir) || true
rmdir -p $(coreconfdir) || true
# Python package cleanup # Python package cleanup
clean-local: clean-local:
@ -40,7 +99,7 @@ clean-local:
# Python RPM package # Python RPM package
rpm: rpm:
$(PYTHON) setup.py bdist_rpm $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) bdist_rpm
# because we include entire directories with EXTRA_DIST, we need to clean up # because we include entire directories with EXTRA_DIST, we need to clean up
# the source control files # the source control files
@ -51,4 +110,4 @@ DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST doc/Makefile.in doc/Makefile \
doc/conf.py core/addons/*.pyc doc/conf.py core/addons/*.pyc
# files to include with distribution tarball # files to include with distribution tarball
EXTRA_DIST = setup.py MANIFEST.in CORE.e4p core data examples sbin doc EXTRA_DIST = $(SETUPPY) MANIFEST.in CORE.e4p core doc

View file

@ -7,19 +7,32 @@
# Makefile for building corens3 components. # Makefile for building corens3 components.
# #
SETUPPY = setup.py
SETUPPYFLAGS = -v
EXAMPLE_FILES = \
examples/ns3lte.py \
examples/ns3wifi.py \
examples/ns3wifirandomwalk.py \
examples/ns3wimax.py
coreexampledir = $(datadir)/core/examples
dist_coreexample_DATA = $(EXAMPLE_FILES)
# Python package build # Python package build
noinst_SCRIPTS = build noinst_SCRIPTS = build
build: build:
$(PYTHON) setup.py build $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) build
# Python package install # Python package install
install-exec-hook: install-exec-hook:
CORE_CONF_DIR=${DESTDIR}/${CORE_CONF_DIR} $(PYTHON) setup.py install --prefix=${DESTDIR}/${pyprefix} --install-purelib=${DESTDIR}/${pythondir} --install-platlib=${DESTDIR}/${pyexecdir} --no-compile $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install --prefix=${DESTDIR}/${pyprefix} --install-purelib=${DESTDIR}/${pythondir} --install-platlib=${DESTDIR}/${pyexecdir} --no-compile
# Python package uninstall # Python package uninstall
uninstall-hook: uninstall-hook:
rm -f ${pythondir}/corens3_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info rm -f ${pythondir}/corens3_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info
rm -rf ${pythondir}/corens3 rm -rf ${pythondir}/corens3
rmdir -p $(coreexampledir) || true
# Python package cleanup # Python package cleanup
clean-local: clean-local:
@ -27,7 +40,7 @@ clean-local:
# Python RPM package # Python RPM package
rpm: rpm:
$(PYTHON) setup.py bdist_rpm $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) bdist_rpm
# because we include entire directories with EXTRA_DIST, we need to clean up # because we include entire directories with EXTRA_DIST, we need to clean up
# the source control files # the source control files
@ -37,4 +50,4 @@ dist-hook:
DISTCLEANFILES = Makefile.in *.pyc corens3/*.pyc MANIFEST DISTCLEANFILES = Makefile.in *.pyc corens3/*.pyc MANIFEST
# files to include with distribution tarball # files to include with distribution tarball
EXTRA_DIST = LICENSE setup.py corens3 examples EXTRA_DIST = LICENSE $(SETUPPY) corens3

View file

@ -5,20 +5,11 @@ import os, glob
from distutils.core import setup from distutils.core import setup
from corens3.constants import COREDPY_VERSION from corens3.constants import COREDPY_VERSION
# optionally pass CORE_CONF_DIR using environment variable
confdir = os.environ.get('CORE_CONF_DIR')
if confdir is None:
confdir="/etc/core"
setup(name = "corens3-python", setup(name = "corens3-python",
version = COREDPY_VERSION, version = COREDPY_VERSION,
packages = [ packages = [
"corens3", "corens3",
], ],
data_files = [
("share/core/examples/corens3",
glob.glob("examples/*.py")),
],
description = "Python ns-3 components of CORE", description = "Python ns-3 components of CORE",
url = "http://www.nrl.navy.mil/itd/ncs/products/core", url = "http://www.nrl.navy.mil/itd/ncs/products/core",
author = "Boeing Research & Technology", author = "Boeing Research & Technology",

View file

@ -5,11 +5,6 @@ import os, glob
from distutils.core import setup from distutils.core import setup
from core.constants import COREDPY_VERSION from core.constants import COREDPY_VERSION
# optionally pass CORE_CONF_DIR using environment variable
confdir = os.environ.get('CORE_CONF_DIR')
if confdir is None:
confdir="/etc/core"
setup(name = "core-python", setup(name = "core-python",
version = COREDPY_VERSION, version = COREDPY_VERSION,
packages = [ packages = [
@ -24,19 +19,6 @@ setup(name = "core-python",
"core.xen", "core.xen",
"core.services", "core.services",
], ],
data_files = [("sbin", glob.glob("sbin/core*")),
(confdir, ["data/core.conf"]),
(confdir, ["data/xen.conf"]),
("share/core/examples", ["examples/controlnet_updown"]),
("share/core/examples",
glob.glob("examples/*.py")),
("share/core/examples/netns",
glob.glob("examples/netns/*[py,sh]")),
("share/core/examples/services",
glob.glob("examples/services/*")),
("share/core/examples/myservices",
glob.glob("examples/myservices/*")),
],
description = "Python components of CORE", description = "Python components of CORE",
url = "http://www.nrl.navy.mil/itd/ncs/products/core", url = "http://www.nrl.navy.mil/itd/ncs/products/core",
author = "Boeing Research & Technology", author = "Boeing Research & Technology",