first pass at removing all python2 specific dependencies, updating python requirements.txt/setup.py/Pipfiles/Makefiles, and removing python2 compat imports

This commit is contained in:
Blake Harnden 2019-10-17 14:52:31 -07:00
parent 5d5ffb70c2
commit 6edd6a7fdb
13 changed files with 89 additions and 143 deletions

View file

@ -44,15 +44,6 @@ DISTCLEANFILES = aclocal.m4 \
MAINTAINERCLEANFILES = .version \ MAINTAINERCLEANFILES = .version \
.version.date .version.date
if PYTHON3
PYTHON_DEB_DEP = python3 >= 3.6
PYTHON_RPM_DEP = python3 >= 3.6
else
PYTHON_DEB_DEP = python (>= 2.7), python (<< 3.0)
PYTHON_RPM_DEP = python >= 2.7, python < 3.0
endif
define fpm-rpm = define fpm-rpm =
fpm -s dir -t rpm -n core \ fpm -s dir -t rpm -n core \
-m "$(PACKAGE_MAINTAINERS)" \ -m "$(PACKAGE_MAINTAINERS)" \
@ -74,7 +65,7 @@ fpm -s dir -t rpm -n core \
-d "iproute" \ -d "iproute" \
-d "libev" \ -d "libev" \
-d "net-tools" \ -d "net-tools" \
-d "$(PYTHON_RPM_DEP)" \ -d "python3 >= 3.6" \
-C $(DESTDIR) -C $(DESTDIR)
endef endef
@ -101,7 +92,7 @@ fpm -s dir -t deb -n core \
-d "ebtables" \ -d "ebtables" \
-d "iproute2" \ -d "iproute2" \
-d "libev4" \ -d "libev4" \
-d "$(PYTHON_DEB_DEP)" \ -d "python3 >= 3.6" \
-C $(DESTDIR) -C $(DESTDIR)
endef endef

View file

@ -55,12 +55,6 @@ else
want_python=no want_python=no
fi fi
AC_ARG_ENABLE([python3],
[AS_HELP_STRING([--enable-python3],
[sets python3 flag for building packages])],
[enable_python3=yes], [enable_python3=no])
AM_CONDITIONAL([PYTHON3], [test "x$enable_python3" == "xyes"])
AC_ARG_ENABLE([daemon], AC_ARG_ENABLE([daemon],
[AS_HELP_STRING([--enable-daemon[=ARG]], [AS_HELP_STRING([--enable-daemon[=ARG]],
[build and install the daemon with Python modules [build and install the daemon with Python modules
@ -116,7 +110,7 @@ if test "x$enable_daemon" = "xyes"; then
AC_FUNC_REALLOC AC_FUNC_REALLOC
AC_CHECK_FUNCS([atexit dup2 gettimeofday memset socket strerror uname]) AC_CHECK_FUNCS([atexit dup2 gettimeofday memset socket strerror uname])
AM_PATH_PYTHON(2.7) AM_PATH_PYTHON(3.6)
AS_IF([$PYTHON -m grpc_tools.protoc -h &> /dev/null], [], [AC_MSG_ERROR([please install python grpcio-tools])]) AS_IF([$PYTHON -m grpc_tools.protoc -h &> /dev/null], [], [AC_MSG_ERROR([please install python grpcio-tools])])
AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH) AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH)

View file

@ -14,8 +14,6 @@ if WANT_DOCS
DOCS = doc DOCS = doc
endif endif
PYTHONLIBDIR=$(subst site-packages,dist-packages,$(pythondir))
SUBDIRS = proto $(DOCS) SUBDIRS = proto $(DOCS)
SCRIPT_FILES := $(notdir $(wildcard scripts/*)) SCRIPT_FILES := $(notdir $(wildcard scripts/*))
@ -31,7 +29,7 @@ install-exec-hook:
$(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \
--root=/$(DESTDIR) \ --root=/$(DESTDIR) \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-lib=$(PYTHONLIBDIR) \ --install-lib=$(pythondir) \
--single-version-externally-managed --single-version-externally-managed
# Python package uninstall # Python package uninstall
@ -40,8 +38,8 @@ uninstall-hook:
rm -rf $(DESTDIR)/$(datadir)/core rm -rf $(DESTDIR)/$(datadir)/core
rm -f $(addprefix $(DESTDIR)/$(datarootdir)/man/man1/, $(MAN_FILES)) rm -f $(addprefix $(DESTDIR)/$(datarootdir)/man/man1/, $(MAN_FILES))
rm -f $(addprefix $(DESTDIR)/$(bindir)/,$(SCRIPT_FILES)) rm -f $(addprefix $(DESTDIR)/$(bindir)/,$(SCRIPT_FILES))
rm -rf $(DESTDIR)/$(PYTHONLIBDIR)/core-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info rm -rf $(DESTDIR)/$(pythondir)/core-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
rm -rf $(DESTDIR)/$(PYTHONLIBDIR)/core rm -rf $(DESTDIR)/$(pythondir)/core
# Python package cleanup # Python package cleanup
clean-local: clean-local:

141
daemon/Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "d702e6eed5a1362bf261543572bbffd2e8a87140b8d8cb07b99fb0d25220a2b5" "sha256": "6195c89ec6e2e449fcbd7f3fa41cbab79c02d952984a913e0f80114e1904bf11"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": {}, "requires": {},
@ -14,13 +14,6 @@
] ]
}, },
"default": { "default": {
"asn1crypto": {
"hashes": [
"sha256:0b199f211ae690df3db4fd6c1c4ff976497fb1da689193e368eedbadc53d9292",
"sha256:bca90060bd995c3f62c4433168eab407e44bdbdb567b3f3a396a676c1a4c4a3f"
],
"version": "==1.0.1"
},
"bcrypt": { "bcrypt": {
"hashes": [ "hashes": [
"sha256:0258f143f3de96b7c14f762c770f5fc56ccd72f8a1857a451c1cd9a655d9ac89", "sha256:0258f143f3de96b7c14f762c770f5fc56ccd72f8a1857a451c1cd9a655d9ac89",
@ -44,43 +37,40 @@
}, },
"cffi": { "cffi": {
"hashes": [ "hashes": [
"sha256:041c81822e9f84b1d9c401182e174996f0bae9991f33725d059b771744290774", "sha256:08f99e8b38d5134d504aa7e486af8e4fde66a2f388bbecc270cdd1e00fa09ff8",
"sha256:046ef9a22f5d3eed06334d01b1e836977eeef500d9b78e9ef693f9380ad0b83d", "sha256:1112d2fc92a867a6103bce6740a549e74b1d320cf28875609f6e93857eee4f2d",
"sha256:066bc4c7895c91812eff46f4b1c285220947d4aa46fa0a2651ff85f2afae9c90", "sha256:1b9ab50c74e075bd2ae489853c5f7f592160b379df53b7f72befcbe145475a36",
"sha256:066c7ff148ae33040c01058662d6752fd73fbc8e64787229ea8498c7d7f4041b", "sha256:24eff2997436b6156c2f30bed215c782b1d8fd8c6a704206053c79af95962e45",
"sha256:2444d0c61f03dcd26dbf7600cf64354376ee579acad77aef459e34efcb438c63", "sha256:2eff642fbc9877a6449026ad66bf37c73bf4232505fb557168ba5c502f95999b",
"sha256:300832850b8f7967e278870c5d51e3819b9aad8f0a2c8dbe39ab11f119237f45", "sha256:362e896cea1249ed5c2a81cf6477fabd9e1a5088aa7ea08358a4c6b0998294d2",
"sha256:34c77afe85b6b9e967bd8154e3855e847b70ca42043db6ad17f26899a3df1b25", "sha256:40eddb3589f382cb950f2dcf1c39c9b8d7bd5af20665ce273815b0d24635008b",
"sha256:46de5fa00f7ac09f020729148ff632819649b3e05a007d286242c4882f7b1dc3", "sha256:5ed40760976f6b8613d4a0db5e423673ca162d4ed6c9ed92d1f4e58a47ee01b5",
"sha256:4aa8ee7ba27c472d429b980c51e714a24f47ca296d53f4d7868075b175866f4b", "sha256:632c6112c1e914c486f06cfe3f0cc507f44aa1e00ebf732cedb5719e6aa0466a",
"sha256:4d0004eb4351e35ed950c14c11e734182591465a33e960a4ab5e8d4f04d72647", "sha256:64d84f0145e181f4e6cc942088603c8db3ae23485c37eeda71cb3900b5e67cb4",
"sha256:4e3d3f31a1e202b0f5a35ba3bc4eb41e2fc2b11c1eff38b362de710bcffb5016", "sha256:6cb4edcf87d0e7f5bdc7e5c1a0756fbb37081b2181293c5fdf203347df1cd2a2",
"sha256:50bec6d35e6b1aaeb17f7c4e2b9374ebf95a8975d57863546fa83e8d31bdb8c4", "sha256:6f19c9df4785305669335b934c852133faed913c0faa63056248168966f7a7d5",
"sha256:55cad9a6df1e2a1d62063f79d0881a414a906a6962bc160ac968cc03ed3efcfb", "sha256:719537b4c5cd5218f0f47826dd705fb7a21d83824920088c4214794457113f3f",
"sha256:5662ad4e4e84f1eaa8efce5da695c5d2e229c563f9d5ce5b0113f71321bcf753", "sha256:7b0e337a70e58f1a36fb483fd63880c9e74f1db5c532b4082bceac83df1523fa",
"sha256:59b4dc008f98fc6ee2bb4fd7fc786a8d70000d058c2bbe2698275bc53a8d3fa7", "sha256:853376efeeb8a4ae49a737d5d30f5db8cdf01d9319695719c4af126488df5a6a",
"sha256:73e1ffefe05e4ccd7bcea61af76f36077b914f92b76f95ccf00b0c1b9186f3f9", "sha256:85bbf77ffd12985d76a69d2feb449e35ecdcb4fc54a5f087d2bd54158ae5bb0c",
"sha256:a1f0fd46eba2d71ce1589f7e50a9e2ffaeb739fb2c11e8192aa2b45d5f6cc41f", "sha256:8978115c6f0b0ce5880bc21c967c65058be8a15f1b81aa5fdbdcbea0e03952d1",
"sha256:a2e85dc204556657661051ff4bab75a84e968669765c8a2cd425918699c3d0e8", "sha256:8f7eec920bc83692231d7306b3e311586c2e340db2dc734c43c37fbf9c981d24",
"sha256:a5457d47dfff24882a21492e5815f891c0ca35fefae8aa742c6c263dac16ef1f", "sha256:8fe230f612c18af1df6f348d02d682fe2c28ca0a6c3856c99599cdacae7cf226",
"sha256:a8dccd61d52a8dae4a825cdbb7735da530179fea472903eb871a5513b5abbfdc", "sha256:92068ebc494b5f9826b822cec6569f1f47b9a446a3fef477e1d11d7fac9ea895",
"sha256:ae61af521ed676cf16ae94f30fe202781a38d7178b6b4ab622e4eec8cefaff42", "sha256:b57e1c8bcdd7340e9c9d09613b5e7fdd0c600be142f04e2cc1cc8cb7c0b43529",
"sha256:b012a5edb48288f77a63dba0840c92d0504aa215612da4541b7b42d849bc83a3", "sha256:ba956c9b44646bc1852db715b4a252e52a8f5a4009b57f1dac48ba3203a7bde1",
"sha256:d2c5cfa536227f57f97c92ac30c8109688ace8fa4ac086d19d0af47d134e2909", "sha256:ca42034c11eb447497ea0e7b855d87ccc2aebc1e253c22e7d276b8599c112a27",
"sha256:d42b5796e20aacc9d15e66befb7a345454eef794fdb0737d1af593447c6c8f45", "sha256:dc9b2003e9a62bbe0c84a04c61b0329e86fccd85134a78d7aca373bbbf788165",
"sha256:dee54f5d30d775f525894d67b1495625dd9322945e7fee00731952e0368ff42d", "sha256:dd308802beb4b2961af8f037becbdf01a1e85009fdfc14088614c1b3c383fae5",
"sha256:e070535507bd6aa07124258171be2ee8dfc19119c28ca94c9dfb7efd23564512", "sha256:e77cd105b19b8cd721d101687fcf665fd1553eb7b57556a1ef0d453b6fc42faa",
"sha256:e1ff2748c84d97b065cc95429814cdba39bcbd77c9c85c89344b317dc0d9cbff", "sha256:f56dff1bd81022f1c980754ec721fb8da56192b026f17f0f99b965da5ab4fbd2",
"sha256:ed851c75d1e0e043cbf5ca9a8e1b13c4c90f3fbd863dacb01c0808e2b5204201" "sha256:fa4cc13c03ea1d0d37ce8528e0ecc988d2365e8ac64d8d86cafab4038cb4ce89",
"sha256:fa8cf1cb974a9f5911d2a0303f6adc40625c05578d8e7ff5d313e1e27850bd59",
"sha256:fb003019f06d5fc0aa4738492ad8df1fa343b8a37cbcf634018ad78575d185df",
"sha256:fd409b7778167c3bcc836484a8f49c0e0b93d3e745d975749f83aa5d18a5822f",
"sha256:fe5d65a3ee38122003245a82303d11ac05ff36531a8f5ce4bc7d4bbc012797e1"
], ],
"version": "==1.12.3" "version": "==1.13.0"
},
"configparser": {
"hashes": [
"sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c",
"sha256:c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df"
],
"version": "==4.0.2"
}, },
"core": { "core": {
"editable": true, "editable": true,
@ -88,24 +78,29 @@
}, },
"cryptography": { "cryptography": {
"hashes": [ "hashes": [
"sha256:24b61e5fcb506424d3ec4e18bca995833839bf13c59fc43e530e488f28d46b8c", "sha256:02079a6addc7b5140ba0825f542c0869ff4df9a69c360e339ecead5baefa843c",
"sha256:25dd1581a183e9e7a806fe0543f485103232f940fcfc301db65e630512cce643", "sha256:1df22371fbf2004c6f64e927668734070a8953362cd8370ddd336774d6743595",
"sha256:3452bba7c21c69f2df772762be0066c7ed5dc65df494a1d53a58b683a83e1216", "sha256:369d2346db5934345787451504853ad9d342d7f721ae82d098083e1f49a582ad",
"sha256:41a0be220dd1ed9e998f5891948306eb8c812b512dc398e5a01846d855050799", "sha256:3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651",
"sha256:5751d8a11b956fbfa314f6553d186b94aa70fdb03d8a4d4f1c82dcacf0cbe28a", "sha256:44ff04138935882fef7c686878e1c8fd80a723161ad6a98da31e14b7553170c2",
"sha256:5f61c7d749048fa6e3322258b4263463bfccefecb0dd731b6561cb617a1d9bb9", "sha256:4b1030728872c59687badcca1e225a9103440e467c17d6d1730ab3d2d64bfeff",
"sha256:72e24c521fa2106f19623a3851e9f89ddfdeb9ac63871c7643790f872a305dfc", "sha256:58363dbd966afb4f89b3b11dfb8ff200058fbc3b947507675c19ceb46104b48d",
"sha256:7b97ae6ef5cba2e3bb14256625423413d5ce8d1abb91d4f29b6d1a081da765f8", "sha256:6ec280fb24d27e3d97aa731e16207d58bd8ae94ef6eab97249a2afe4ba643d42",
"sha256:961e886d8a3590fd2c723cf07be14e2a91cf53c25f02435c04d39e90780e3b53", "sha256:7270a6c29199adc1297776937a05b59720e8a782531f1f122f2eb8467f9aab4d",
"sha256:96d8473848e984184b6728e2c9d391482008646276c3ff084a1bd89e15ff53a1", "sha256:73fd30c57fa2d0a1d7a49c561c40c2f79c7d6c374cc7750e9ac7c99176f6428e",
"sha256:ae536da50c7ad1e002c3eee101871d93abdc90d9c5f651818450a0d3af718609", "sha256:7f09806ed4fbea8f51585231ba742b58cbcfbfe823ea197d8c89a5e433c7e912",
"sha256:b0db0cecf396033abb4a93c95d1602f268b3a68bb0a9cc06a7cff587bb9a7292", "sha256:90df0cc93e1f8d2fba8365fb59a858f51a11a394d64dbf3ef844f783844cc793",
"sha256:cfee9164954c186b191b91d4193989ca994703b2fff406f71cf454a2d3c7327e", "sha256:971221ed40f058f5662a604bd1ae6e4521d84e6cad0b7b170564cc34169c8f13",
"sha256:e6347742ac8f35ded4a46ff835c60e68c22a536a8ae5c4422966d06946b6d4c6", "sha256:a518c153a2b5ed6b8cc03f7ae79d5ffad7315ad4569b2d5333a13c38d64bd8d7",
"sha256:f27d93f0139a3c056172ebb5d4f9056e770fdf0206c2f422ff2ebbad142e09ed", "sha256:b0de590a8b0979649ebeef8bb9f54394d3a41f66c5584fff4220901739b6b2f0",
"sha256:f57b76e46a58b63d1c6375017f4564a28f19a5ca912691fd2e4261b3414b618d" "sha256:b43f53f29816ba1db8525f006fa6f49292e9b029554b3eb56a189a70f2a40879",
"sha256:d31402aad60ed889c7e57934a03477b572a03af7794fa8fb1780f21ea8f6551f",
"sha256:de96157ec73458a7f14e3d26f17f8128c959084931e8997b9e655a39c8fde9f9",
"sha256:df6b4dca2e11865e6cfbfb708e800efb18370f5a46fd601d3755bc7f85b3a8a2",
"sha256:ecadccc7ba52193963c0475ac9f6fa28ac01e01349a2ca48509667ef41ffd2cf",
"sha256:fb81c17e0ebe3358486cd8cc3ad78adbae58af12fc2bf2bc0bb84e8090fa5ce8"
], ],
"version": "==2.7" "version": "==2.8"
}, },
"fabric": { "fabric": {
"hashes": [ "hashes": [
@ -114,12 +109,6 @@
], ],
"version": "==2.5.0" "version": "==2.5.0"
}, },
"future": {
"hashes": [
"sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8"
],
"version": "==0.17.1"
},
"grpcio": { "grpcio": {
"hashes": [ "hashes": [
"sha256:0302331e014fc4bac028b6ad480b33f7abfe20b9bdcca7be417124dda8f22115", "sha256:0302331e014fc4bac028b6ad480b33f7abfe20b9bdcca7be417124dda8f22115",
@ -282,10 +271,10 @@
}, },
"attrs": { "attrs": {
"hashes": [ "hashes": [
"sha256:ec20e7a4825331c1b5ebf261d111e16fa9612c1f7a5e1f884f12bd53a664dfd2", "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
"sha256:f913492e1663d3c36f502e5e9ba6cd13cf19d7fab50aa13239e420fef95e1396" "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"
], ],
"version": "==19.2.0" "version": "==19.3.0"
}, },
"black": { "black": {
"hashes": [ "hashes": [
@ -531,11 +520,11 @@
}, },
"pytest": { "pytest": {
"hashes": [ "hashes": [
"sha256:13c1c9b22127a77fc684eee24791efafcef343335d855e3573791c68588fe1a5", "sha256:7e4800063ccfc306a53c461442526c5571e1462f61583506ce97e4da6a1d88c8",
"sha256:d8ba7be9466f55ef96ba203fc0f90d0cf212f2f927e69186e1353e30bc7f62e5" "sha256:ca563435f4941d0cb34767301c27bc65c510cb82e90b9ecf9cb52dc2c63caaa0"
], ],
"index": "pypi", "index": "pypi",
"version": "==5.2.0" "version": "==5.2.1"
}, },
"pyyaml": { "pyyaml": {
"hashes": [ "hashes": [
@ -571,10 +560,10 @@
}, },
"virtualenv": { "virtualenv": {
"hashes": [ "hashes": [
"sha256:680af46846662bb38c5504b78bad9ed9e4f3ba2d54f54ba42494fdf94337fe30", "sha256:3e3597e89c73df9313f5566e8fc582bd7037938d15b05329c232ec57a11a7ad5",
"sha256:f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2" "sha256:5d370508bf32e522d79096e8cbea3499d47e624ac7e11e9089f9397a0b3318df"
], ],
"version": "==16.7.5" "version": "==16.7.6"
}, },
"wcwidth": { "wcwidth": {
"hashes": [ "hashes": [

View file

@ -9,8 +9,6 @@ import socket
import struct import struct
from enum import Enum from enum import Enum
from past.builtins import basestring
from core.api.tlv import structutils from core.api.tlv import structutils
from core.emulator.enumerations import ( from core.emulator.enumerations import (
ConfigTlvs, ConfigTlvs,
@ -181,7 +179,7 @@ class CoreTlvDataString(CoreTlvData):
:return: length of data packed and the packed data :return: length of data packed and the packed data
:rtype: tuple :rtype: tuple
""" """
if not isinstance(value, basestring): if not isinstance(value, str):
raise ValueError("value not a string: %s" % type(value)) raise ValueError("value not a string: %s" % type(value))
value = value.encode("utf-8") value = value.encode("utf-8")

View file

@ -4,8 +4,6 @@ Utilities for working with python struct data.
import logging import logging
from past.builtins import basestring
def pack_values(clazz, packers): def pack_values(clazz, packers):
""" """
@ -31,7 +29,7 @@ def pack_values(clazz, packers):
# only pack actual values and avoid packing empty strings # only pack actual values and avoid packing empty strings
# protobuf defaults to empty strings and does no imply a value to set # protobuf defaults to empty strings and does no imply a value to set
if value is None or (isinstance(value, basestring) and not value): if value is None or (isinstance(value, str) and not value):
continue continue
# transform values as needed # transform values as needed

View file

@ -7,7 +7,6 @@ import os
from builtins import int from builtins import int
from lxml import etree from lxml import etree
from past.builtins import basestring
from core.config import ConfigGroup from core.config import ConfigGroup
from core.emane import emanemanifest, emanemodel from core.emane import emanemanifest, emanemodel
@ -26,7 +25,7 @@ def convert_none(x):
""" """
Helper to use 0 for None values. Helper to use 0 for None values.
""" """
if isinstance(x, basestring): if isinstance(x, str):
x = float(x) x = float(x)
if x is None: if x is None:
return 0 return 0

View file

@ -5,8 +5,7 @@ event.py: event loop implementation using a heap queue and threads.
import heapq import heapq
import threading import threading
import time import time
from functools import total_ordering
from past.builtins import cmp
class Timer(threading.Thread): class Timer(threading.Thread):
@ -70,6 +69,7 @@ class Timer(threading.Thread):
self.finished.set() self.finished.set()
@total_ordering
class Event(object): class Event(object):
""" """
Provides event objects that can be used within the EventLoop class. Provides event objects that can be used within the EventLoop class.
@ -92,18 +92,11 @@ class Event(object):
self.kwds = kwds self.kwds = kwds
self.canceled = False self.canceled = False
def __cmp__(self, other): def __lt__(self, other):
""" result = self.time < other.time
Comparison function. if result:
result = self.eventnum < other.eventnum
:param Event other: event to compare with return result
:return: comparison result
:rtype: int
"""
tmp = cmp(self.time, other.time)
if tmp == 0:
tmp = cmp(self.eventnum, other.eventnum)
return tmp
def run(self): def run(self):
""" """

View file

@ -4,8 +4,7 @@ sdt.py: Scripted Display Tool (SDT3D) helper
import logging import logging
import socket import socket
from urllib.parse import urlparse
from future.moves.urllib.parse import urlparse
from core import constants from core import constants
from core.emane.nodes import EmaneNet from core.emane.nodes import EmaneNet

View file

@ -3,8 +3,6 @@ nrl.py: defines services provided by NRL protolib tools hosted here:
http://www.nrl.navy.mil/itd/ncs/products http://www.nrl.navy.mil/itd/ncs/products
""" """
from past.builtins import filter
from core import utils from core import utils
from core.nodes.ipaddress import Ipv4Prefix from core.nodes.ipaddress import Ipv4Prefix
from core.services.coreservices import CoreService from core.services.coreservices import CoreService
@ -94,7 +92,7 @@ class NrlNhdp(NrlService):
cmd += " -flooding ecds" cmd += " -flooding ecds"
cmd += " -smfClient %s_smf" % node.name cmd += " -smfClient %s_smf" % node.name
netifs = filter(lambda x: not getattr(x, "control", False), node.netifs()) netifs = list(filter(lambda x: not getattr(x, "control", False), node.netifs()))
if len(netifs) > 0: if len(netifs) > 0:
interfacenames = map(lambda x: x.name, netifs) interfacenames = map(lambda x: x.name, netifs)
cmd += " -i " cmd += " -i "
@ -128,7 +126,7 @@ class NrlSmf(NrlService):
cmd = "nrlsmf instance %s_smf" % node.name cmd = "nrlsmf instance %s_smf" % node.name
servicenames = map(lambda x: x.name, node.services) servicenames = map(lambda x: x.name, node.services)
netifs = filter(lambda x: not getattr(x, "control", False), node.netifs()) netifs = list(filter(lambda x: not getattr(x, "control", False), node.netifs()))
if len(netifs) == 0: if len(netifs) == 0:
return "" return ""
@ -218,7 +216,7 @@ class NrlOlsrv2(NrlService):
cmd += " -p olsr" cmd += " -p olsr"
netifs = filter(lambda x: not getattr(x, "control", False), node.netifs()) netifs = list(filter(lambda x: not getattr(x, "control", False), node.netifs()))
if len(netifs) > 0: if len(netifs) > 0:
interfacenames = map(lambda x: x.name, netifs) interfacenames = map(lambda x: x.name, netifs)
cmd += " -i " cmd += " -i "
@ -246,7 +244,7 @@ class OlsrOrg(NrlService):
Generate the appropriate command-line based on node interfaces. Generate the appropriate command-line based on node interfaces.
""" """
cmd = cls.startup[0] cmd = cls.startup[0]
netifs = filter(lambda x: not getattr(x, "control", False), node.netifs()) netifs = list(filter(lambda x: not getattr(x, "control", False), node.netifs()))
if len(netifs) > 0: if len(netifs) > 0:
interfacenames = map(lambda x: x.name, netifs) interfacenames = map(lambda x: x.name, netifs)
cmd += " -i " cmd += " -i "

View file

@ -1,9 +1,6 @@
configparser==4.0.2
fabric==2.5.0 fabric==2.5.0
future==0.17.1
grpcio==1.23.0 grpcio==1.23.0
grpcio-tools==1.21.1 grpcio-tools==1.21.1
invoke==1.3.0 invoke==1.3.0
lxml==4.4.1 lxml==4.4.1
protobuf==3.9.1 protobuf==3.9.1
six==1.12.0

View file

@ -34,18 +34,12 @@ setup(
version="@PACKAGE_VERSION@", version="@PACKAGE_VERSION@",
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
"configparser",
"fabric", "fabric",
"future",
"grpcio", "grpcio",
"invoke", "invoke",
"lxml", "lxml",
"protobuf", "protobuf",
], ],
extra_require={
":python_version<'3.2'": ["futures"],
":python_version<'3.4'": ["enum34"],
},
tests_require=[ tests_require=[
"pytest", "pytest",
"mock", "mock",

View file

@ -9,8 +9,6 @@
if WANT_PYTHON if WANT_PYTHON
PYTHONLIBDIR=$(subst site-packages,dist-packages,$(pythondir))
SETUPPY = setup.py SETUPPY = setup.py
SETUPPYFLAGS = -v SETUPPYFLAGS = -v
@ -24,15 +22,15 @@ install-exec-hook:
$(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \
--root=/$(DESTDIR) \ --root=/$(DESTDIR) \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-lib=$(PYTHONLIBDIR) \ --install-lib=$(pythondir) \
--single-version-externally-managed \ --single-version-externally-managed \
--no-compile --no-compile
# Python package uninstall # Python package uninstall
uninstall-hook: uninstall-hook:
-rm -rf core_ns3.egg-info -rm -rf core_ns3.egg-info
-rm -rf $(DESTDIR)/$(PYTHONLIBDIR)/core_ns3-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info -rm -rf $(DESTDIR)/$(pythondir)/core_ns3-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
-rm -rf $(DESTDIR)/$(PYTHONLIBDIR)/corens3 -rm -rf $(DESTDIR)/$(pythondir)/corens3
-rm -rf $(DESTDIR)/$(datadir)/corens3 -rm -rf $(DESTDIR)/$(datadir)/corens3
# Python package cleanup # Python package cleanup