sys-apps/selinux-python: Add package and deps

Note that these dependencies include the fixes for two gentoo bugs:
https://bugs.gentoo.org/642634
https://bugs.gentoo.org/744487

Patches for these have been submitted upstream.

BUG=none
TEST=sudo emerge sys-apps/selinux-python

Change-Id: If11c5429d08130ab75912491e27b5200e69bba24
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2428484
Tested-by: Fergus Dall <sidereal@google.com>
Reviewed-by: Qijiang Fan <fqj@google.com>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Fergus Dall <sidereal@google.com>
diff --git a/app-admin/setools/Manifest b/app-admin/setools/Manifest
new file mode 100644
index 0000000..e834e07
--- /dev/null
+++ b/app-admin/setools/Manifest
@@ -0,0 +1 @@
+DIST setools-4.3.0.tar.bz2 249694 BLAKE2B 03d689f0f7dcc5ad7cf1ed114b7466aa0add96b70aa4b4a0a563805ad58cd1bde5651b155d202835e238aee9f07bf7595bfb09c20d2984ef6b921866ac1dca2e SHA512 f2ef045e76223918f16d8b0d8365166d6afa320558269be96f3a8875189607253056179092fb8134aaa2e50a5d0862f246c0aa0f8d33060919f4bc1257c109d8
diff --git a/app-admin/setools/files/setools-4.3.0-remove-gui.patch b/app-admin/setools/files/setools-4.3.0-remove-gui.patch
new file mode 100644
index 0000000..85abbf5
--- /dev/null
+++ b/app-admin/setools/files/setools-4.3.0-remove-gui.patch
@@ -0,0 +1,16 @@
+--- a/setup.py
++++ b/setup.py
+@@ -146,10 +146,10 @@ setup(name='setools',
+       author_email='pebenito@ieee.org',
+       url='https://github.com/SELinuxProject/setools',
+       cmdclass={'build_qhc': QtHelpCommand, 'clean': CleanCommand},
+-      packages=['setools', 'setools.diff', 'setoolsgui', 'setoolsgui.apol'],
+-      scripts=['apol', 'sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta'],
++      packages=['setools', 'setools.diff'],
++      scripts=['sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta'],
+       data_files=installed_data,
+-      package_data={'': ['*.ui', '*.qhc', '*.qch'], 'setools': ['perm_map']},
++      package_data={'setools': ['perm_map']},
+       ext_modules=cythonize(ext_py_mods, include_path=['setools/policyrep'],
+                             annotate=cython_annotate,
+                             compiler_directives={"language_level": 3,
diff --git a/app-admin/setools/metadata.xml b/app-admin/setools/metadata.xml
new file mode 100644
index 0000000..8b667b0
--- /dev/null
+++ b/app-admin/setools/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="project">
+		<email>selinux@gentoo.org</email>
+		<name>SELinux Team</name>
+	</maintainer>
+	<upstream>
+		<remote-id type="github">SELinuxProject/setools</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/app-admin/setools/setools-4.3.0.ebuild b/app-admin/setools/setools-4.3.0.ebuild
new file mode 100644
index 0000000..ba574e9
--- /dev/null
+++ b/app-admin/setools/setools-4.3.0.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+PYTHON_COMPAT=( python{3_6,3_7,3_8,3_9} )
+
+inherit distutils-r1
+
+DESCRIPTION="Policy Analysis Tools for SELinux"
+HOMEPAGE="https://github.com/SELinuxProject/setools/wiki"
+
+if [[ ${PV} == 9999 ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/SELinuxProject/setools.git"
+else
+	SRC_URI="https://github.com/SELinuxProject/setools/releases/download/${PV}/${P}.tar.bz2"
+	KEYWORDS="*"
+fi
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+IUSE="X test"
+RESTRICT="!test? ( test )"
+S="${WORKDIR}/${PN}"
+
+RDEPEND="${PYTHON_DEPS}
+	>=dev-python/networkx-2.0[${PYTHON_USEDEP}]
+	>=sys-libs/libsepol-2.8:=
+	>=sys-libs/libselinux-2.8:=
+	X? (
+		dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
+	)"
+
+DEPEND="${RDEPEND}
+	>=dev-python/cython-0.27
+	test? (
+		sys-apps/checkpolicy
+	)"
+
+python_prepare_all() {
+	sed -i "s/'-Werror', //" "${S}"/setup.py || die "failed to remove Werror"
+	sed -i "s@^lib_dirs = .*@lib_dirs = ['${ROOT:-/}usr/$(get_libdir)']@" "${S}"/setup.py || \
+		die "failed to set lib_dirs"
+
+	use X || local PATCHES=( "${FILESDIR}"/setools-4.3.0-remove-gui.patch )
+	distutils-r1_python_prepare_all
+}
+
+python_test() {
+	esetup.py test
+}
diff --git a/dev-libs/ustr/Manifest b/dev-libs/ustr/Manifest
new file mode 100644
index 0000000..b35cbd2
--- /dev/null
+++ b/dev-libs/ustr/Manifest
@@ -0,0 +1 @@
+DIST ustr-1.0.4.tar.bz2 233723 BLAKE2B 47fd489cadda1487eb131b9a21148d4b21ad46320f5177a0f3c2b2e156a5756918e269053363d47608661a47d8969b8c505192edea316edbd9fc17649d8dbc91 SHA512 b7df6ca3a9f25ee6f5c9ab4325732d348de27c5e02ebff36a7d5706f56b2df994df35bd652825a28e27bbde731c6a5933248d99c670d192b1952e7534eec1510
diff --git a/dev-libs/ustr/files/ustr-1.0.4-build-libs.patch b/dev-libs/ustr/files/ustr-1.0.4-build-libs.patch
new file mode 100644
index 0000000..79fe818
--- /dev/null
+++ b/dev-libs/ustr/files/ustr-1.0.4-build-libs.patch
@@ -0,0 +1,49 @@
+make static lib build/install controllable so we can disable it by default
+
+punt the -debug lib variants ... if people want debug libs, they can rebuild
+the package using their desired build settings.
+
+--- a/Makefile
++++ b/Makefile
+@@ -291,8 +291,10 @@
+ OPT_LIB_SHARED      = libustr-$(VERS_BSO).so.$(VERS_ESO)
+ OPT_LIB_STATIC      = libustr.a
+ 
+-LIB_SHARED = $(DBG_LIB_SHARED) $(OPT_LIB_SHARED)
+-LIB_STATIC = $(DBG_LIB_STATIC) $(OPT_LIB_STATIC)
++LIB_SHARED = $(OPT_LIB_SHARED)
++ifeq ($(USE_STATIC),yes)
++LIB_STATIC = $(OPT_LIB_STATIC)
++endif
+ 
+ DEPS_NONC_ALL  = $(SRC_HDRS) $(SRC_SRCS_H)
+ DEPS_C_ALL     = $(SRC_HDRS)
+@@ -388,17 +390,14 @@
+ 		install -d $(DESTDIR)$(bindir)
+ 		install -d $(DESTDIR)$(libdir)/pkgconfig
+ 		$(HIDE)echo Installing files
++ifeq ($(USE_STATIC),yes)
+ 		install -m 644 -t $(DESTDIR)$(libdir) $(LIB_STATIC)
++endif
+ 		install -m 755 -t $(DESTDIR)$(libdir) $(LIB_SHARED)
+ 		-rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
+ 		ln -s $(OPT_LIB_SHARED) $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
+ 		-rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
+ 		ln -s $(OPT_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
+-		-rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
+-		ln -s $(DBG_LIB_SHARED) $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
+-		-rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
+-		ln -s $(DBG_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
+-		$(LDCONFIG) -n $(DESTDIR)$(libdir)
+ 		install -pm 644 -t $(DESTDIR)$(includedir) $(SRC_HDRS)
+ 		install -pm 644 -t $(DESTDIR)$(SHRDIR) $(SRC_SRCS)
+ 		install -pm 644 -t $(DESTDIR)$(SHRDIR) $(XSRC_SRCS)
+@@ -406,7 +406,7 @@ endif
+ 		install -pm 644 -t $(DESTDIR)$(mandir)/man1 $(MAN_PAGES_1)
+ 		install -pm 644 -t $(DESTDIR)$(mandir)/man3 $(MAN_PAGES_3)
+ 		install -m 755 -t $(DESTDIR)$(bindir) ustr-import
+-		install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr.pc ustr-debug.pc
++		install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr.pc
+ 
+ ustr-import-multilib: ustr-import-multilib.in
+ 		sed -e 's,@INCLUDEDIR@,$(includedir),g' -e 's,@MBINDIR@,$(MBINDIR),g' < $< > $@
diff --git a/dev-libs/ustr/files/ustr-1.0.4-gcc_5-check.patch b/dev-libs/ustr/files/ustr-1.0.4-gcc_5-check.patch
new file mode 100644
index 0000000..b38cf78
--- /dev/null
+++ b/dev-libs/ustr/files/ustr-1.0.4-gcc_5-check.patch
@@ -0,0 +1,27 @@
+--- a/ustr-conf.h.in	2007-10-22 08:00:55.000000000 +0200
++++ b/ustr-conf.h.in	2015-09-10 12:24:34.998796842 +0200
+@@ -4,13 +4,23 @@
+ /* this is the custom version for the library itself, for everyone else
+  * ustr-import generates one depending on the options. */
+ 
++/* Ustr relies on GCC's traditional handling of inline functions, not
++ * the version that was actually standardized in C99. GCC-compatible
++ * compilers define __GNUC_STDC_INLINE__ when using the standard
++ * behavior. When this is set we must restore the old inline behavior:
++ */
++#if defined(__GNUC__) \
++ && defined(__GNUC_STDC_INLINE__)
++#  define inline inline __attribute__ ((gnu_inline))
++#endif
++
+ /* The default is now to link against libc. */
+ #ifndef USTR_CONF_INCLUDE_CODEONLY_HEADERS
+ #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 0
+ #endif
+ 
+ /* We can't: if defined(__GLIBC__) && (!defined(_GNU_SOURCE) || !_GNU_SOURCE)
+- *  because by the time we've included a libc header it's too late. */ 
++ *  because by the time we've included a libc header it's too late. */
+ #ifndef _GNU_SOURCE
+ #define _GNU_SOURCE 1
+ #endif
diff --git a/dev-libs/ustr/metadata.xml b/dev-libs/ustr/metadata.xml
new file mode 100644
index 0000000..0fb02e2
--- /dev/null
+++ b/dev-libs/ustr/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<!-- maintainer-needed -->
+<use>
+	<flag name="ustr-import">Install ustr-import developer program and source code for bundling.</flag>
+</use>
+</pkgmetadata>
diff --git a/dev-libs/ustr/ustr-1.0.4-r8.ebuild b/dev-libs/ustr/ustr-1.0.4-r8.ebuild
new file mode 100644
index 0000000..c906a86
--- /dev/null
+++ b/dev-libs/ustr/ustr-1.0.4-r8.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit toolchain-funcs multilib-minimal
+
+DESCRIPTION="Low-overhead managed string library for C"
+HOMEPAGE="http://www.and.org/ustr/"
+SRC_URI="ftp://ftp.and.org/pub/james/ustr/${PV}/${P}.tar.bz2"
+
+LICENSE="|| ( BSD-2 MIT LGPL-2 )"
+SLOT="0"
+KEYWORDS="*"
+IUSE="static-libs ustr-import"
+
+DOCS=(ChangeLog README README-DEVELOPERS AUTHORS NEWS TODO)
+
+MULTILIB_WRAPPED_HEADERS=(
+	/usr/include/ustr-conf.h
+	/usr/include/ustr-conf-debug.h
+)
+
+src_prepare() {
+	epatch "${FILESDIR}/${P}-gcc_5-check.patch"
+	epatch "${FILESDIR}/${PN}-1.0.4-build-libs.patch"
+	multilib_copy_sources
+}
+
+_emake() {
+	emake \
+		USE_STATIC=$(usex static-libs) \
+		AR="$(tc-getAR)" \
+		CC="$(tc-getCC)" \
+		CFLAGS="${CFLAGS} ${CPPFLAGS}" \
+		LDFLAGS="${LDFLAGS}" \
+		prefix="${EPREFIX}/usr" \
+		libdir="${EPREFIX}/usr/$(get_libdir)" \
+		mandir="${EPREFIX}/usr/share/man" \
+		SHRDIR="${EPREFIX}/usr/share/${P}" \
+		DOCSHRDIR="${EPREFIX}/usr/share/doc/${PF}" \
+		HIDE= \
+		"$@"
+}
+
+multilib_src_configure() {
+	# The included configure tests require execution.
+
+	# We require vsnprintf everywhere as it's in POSIX.
+	printf '#!/bin/sh\necho 0\n' > autoconf_vsnprintf
+	chmod a+rx autoconf_vsnprintf
+
+	# Always use stdint.h as it's in POSIX.
+	sed -i '/have_stdint_h=0/s:=0:=1:' Makefile || die
+
+	# Figure out the size of size_t.
+	printf '#include <sys/types.h>\nint main() { char buf[sizeof(size_t) - 8]; }\n' > sizet_test.c
+	$(tc-getCC) ${CPPFLAGS} ${CFLAGS} -c sizet_test.c 2>/dev/null
+	printf '#!/bin/sh\necho %s\n' $(( $? == 0 )) > autoconf_64b
+	chmod a+rx autoconf_64b
+
+	# Generate the config file now to avoid bad makefile deps.
+	_emake ustr-import
+}
+
+multilib_src_compile() {
+	_emake all-shared
+}
+
+multilib_src_install() {
+	_emake DESTDIR="${D}" install
+
+	if ! use ustr-import ; then
+		rm -r \
+			"${ED}/usr/bin/ustr-import" \
+			"${ED}/usr/share/man/man1/ustr-import.1" \
+			"${ED}/usr/share/${P}" || die
+	fi
+}
+
+multilib_src_test() {
+	_emake check
+}
diff --git a/dev-python/decorator/Manifest b/dev-python/decorator/Manifest
index 03d2bc6..9d1118e 100644
--- a/dev-python/decorator/Manifest
+++ b/dev-python/decorator/Manifest
@@ -1 +1 @@
-DIST decorator-4.2.1.tar.gz 33376 BLAKE2B 29a03fb4af1de8c60c5ba4a4b30f59f8b1aa8bbde107b9d5719cc0a084c45b58f7e14ff2046d7247c43d57717db57aea0db52dc068d73a73188a0e022c058cbb SHA512 8a6fc53f830470fe15d4bf9dfe8cea434019aa2e1734e55f873dc617138a6ba75d63ddf50a3fcd21a8f67d9d1b19c35c75149d8cee157e909aff4873093c4e0e
+DIST decorator-4.4.2.tar.gz 33629 BLAKE2B 5b2c6a1b6aba293d4b93444d4613e3c9af16bd9d6d80ae9eb21112a4a16397ff67e1f648e8118beeb7d17755a2f1bd37b867f73129c42ef7f8654d1c1f609e5f SHA512 c068efd4e70764ac447b772c9c29625c2180dad256b2b4e46a50a8479fc1d7de09b114c2ba11bb37dd58774ed9460d2e0ea9fa76061833a2d3c2676ac91a0db1
diff --git a/dev-python/decorator/decorator-4.2.1.ebuild b/dev-python/decorator/decorator-4.2.1.ebuild
deleted file mode 100644
index 98607f5..0000000
--- a/dev-python/decorator/decorator-4.2.1.ebuild
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy pypy3 )
-
-inherit distutils-r1
-
-DESCRIPTION="Simplifies the usage of decorators for the average programmer"
-HOMEPAGE="https://github.com/micheles/decorator https://pypi.org/project/decorator/"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="*"
-IUSE="doc"
-
-DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
-
-DOCS=( docs/README.rst )
-
-python_test() {
-	"${PYTHON}" src/tests/test.py || die "Tests fail with ${EPYTHON}"
-}
-
-python_install_all() {
-	distutils-r1_python_install_all
-}
diff --git a/dev-python/decorator/decorator-4.4.2-r1.ebuild b/dev-python/decorator/decorator-4.4.2-r1.ebuild
new file mode 100644
index 0000000..5b7eaca
--- /dev/null
+++ b/dev-python/decorator/decorator-4.4.2-r1.ebuild
@@ -0,0 +1,19 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( pypy3 python3_{6,7,8,9} )
+
+inherit distutils-r1
+
+DESCRIPTION="Simplifies the usage of decorators for the average programmer"
+HOMEPAGE="https://github.com/micheles/decorator https://pypi.org/project/decorator/"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="*"
+
+DOCS=( CHANGES.md )
+
+distutils_enable_tests setup.py
diff --git a/dev-python/decorator/metadata.xml b/dev-python/decorator/metadata.xml
index 64b945f..4b350c9 100644
--- a/dev-python/decorator/metadata.xml
+++ b/dev-python/decorator/metadata.xml
@@ -11,6 +11,7 @@
 		usage giving examples of useful decorators, such as memoize, tracing,
 		redirecting_stdout, locked, etc.
 	</longdescription>
+	<stabilize-allarches/>
 	<upstream>
 		<remote-id type="pypi">decorator</remote-id>
 		<remote-id type="github">micheles/decorator</remote-id>
diff --git a/dev-python/ipy/Manifest b/dev-python/ipy/Manifest
new file mode 100644
index 0000000..d6c4280
--- /dev/null
+++ b/dev-python/ipy/Manifest
@@ -0,0 +1 @@
+DIST IPy-1.00.tar.gz 35324 BLAKE2B a0e04201a59c61e5cc8f7ce2837c83dded99d0d786406e2e341183a0903d43ed5496ae8ea05d1bee019007bfef7420be623ab3dc08cce33812f1720a59ca413d SHA512 94a8f26cad0d966fdf8d4e57284eadf4cfde88515af6f5aafc8f9597eb0758324b876039d1a121021ba1ac26be2e2ffa89a3f5803dddefdee03fdb5d65b07a81
diff --git a/dev-python/ipy/ipy-1.00.ebuild b/dev-python/ipy/ipy-1.00.ebuild
new file mode 100644
index 0000000..30cd6d1
--- /dev/null
+++ b/dev-python/ipy/ipy-1.00.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python{3_6,3_7,3_8} )
+
+inherit distutils-r1
+
+MY_PN="IPy"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Class and tools for handling of IPv4 and IPv6 addresses and networks"
+HOMEPAGE="https://github.com/autocracy/python-ipy/wiki https://pypi.org/project/IPy/"
+SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="*"
+IUSE="examples"
+
+BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}/${MY_PN}-${PV}"
+
+python_test() {
+	# 1 test fail under pypy, persistent from 0.82a, not a regression.
+	cp -r test_doc.py README.rst test "${BUILD_DIR}" || die
+	pushd "${BUILD_DIR}" > /dev/null || die
+	"${PYTHON}" test/test_IPy.py || die "Tests fail with ${EPYTHON}"
+	"${PYTHON}" test_doc.py || die "Doctests fail with ${EPYTHON}"
+	popd > /dev/null || die
+}
+
+python_install_all() {
+	if use examples; then
+		docinto examples
+		dodoc -r example/.
+		docompress -x /usr/share/doc/${PF}/examples
+	fi
+
+	distutils-r1_python_install_all
+}
diff --git a/dev-python/ipy/metadata.xml b/dev-python/ipy/metadata.xml
new file mode 100644
index 0000000..4ec7495
--- /dev/null
+++ b/dev-python/ipy/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="project">
+    <email>python@gentoo.org</email>
+    <name>Python</name>
+  </maintainer>
+  <upstream>
+    <remote-id type="pypi">IPy</remote-id>
+    <remote-id type="github">autocracy/python-ipy</remote-id>
+  </upstream>
+</pkgmetadata>
diff --git a/dev-python/networkx/Manifest b/dev-python/networkx/Manifest
new file mode 100644
index 0000000..d19aa0d
--- /dev/null
+++ b/dev-python/networkx/Manifest
@@ -0,0 +1 @@
+DIST networkx-2.5.tar.gz 1542085 BLAKE2B a4d1d1f65a09f8e7cd830a9e670cf540c19b800dffb90aa1cc6ebda8b6116b6181969382f90339254746a3f277d786020506a3c8f10c90ff48999d3b2c3c433e SHA512 ab51198072d20bdba7c9ceb6856631a20a7e9527a7cadb41271a999f57bf60da5488269c6e4e1f3f4f33420ec6493af665386842c216ea1cfadd1792ccb6444e
diff --git a/dev-python/networkx/metadata.xml b/dev-python/networkx/metadata.xml
new file mode 100644
index 0000000..1183be0
--- /dev/null
+++ b/dev-python/networkx/metadata.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="project">
+    <email>python@gentoo.org</email>
+    <name>Python</name>
+  </maintainer>
+  <longdescription lang="en">
+  NetworkX is a Python-based package for the creation, manipulation, and
+  study of the structure, dynamics, and functions of complex networks.
+  The structure of a graph or network is encoded in the edges (connections,
+  links, ties, arcs, bonds) between nodes (vertices, sites, actors). If
+  unqualified, by graph we mean a simple undirected graph, i.e. no
+  self-loops and no multiple edges are allowed. By a network we usually
+  mean a graph with weights (fields, properties) on nodes and/or edges.
+  The potential audience for NetworkX includes: mathematicians, physicists,
+  biologists, computer scientists, social scientists.
+</longdescription>
+  <stabilize-allarches/>
+  <upstream>
+    <remote-id type="pypi">networkx</remote-id>
+    <remote-id type="github">networkx/networkx</remote-id>
+  </upstream>
+  <use>
+    <flag name="extras">Provide graph drawing and graph layout algorithms along with shapefile format reading and writing</flag>
+    <flag name="pandas">Provides a DataFrame, which is a tabular data structure with labeled axes</flag>
+    <flag name="scipy">Enables scipy backend</flag>
+    <flag name="yaml">Provides YAML format reading and writing</flag>
+  </use>
+</pkgmetadata>
diff --git a/dev-python/networkx/networkx-2.5.ebuild b/dev-python/networkx/networkx-2.5.ebuild
new file mode 100644
index 0000000..8c256c0
--- /dev/null
+++ b/dev-python/networkx/networkx-2.5.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+inherit distutils-r1 virtualx
+
+DESCRIPTION="Python tools to manipulate graphs and complex networks"
+HOMEPAGE="https://networkx.github.io/ https://github.com/networkx/networkx"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="*"
+IUSE="examples extras pandas scipy test xml yaml"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	>=dev-python/decorator-4.3.0[${PYTHON_USEDEP}]
+	>=dev-python/matplotlib-2.2.2[${PYTHON_USEDEP}]
+	extras? (
+		>=dev-python/pydot-1.2.4[${PYTHON_USEDEP}]
+		$(python_gen_cond_dep '
+			>=dev-python/pygraphviz-1.5[${PYTHON_USEDEP}]
+			>=sci-libs/gdal-1.10.0[python,${PYTHON_USEDEP}]
+		' python3_{6,7,8})
+	)
+	pandas? (
+		>=dev-python/pandas-0.23.3[${PYTHON_USEDEP}]
+	)
+	scipy? ( >=dev-python/scipy-1.1.0[${PYTHON_USEDEP}] )
+	xml? ( >=dev-python/lxml-4.2.3[${PYTHON_USEDEP}] )
+	yaml? ( >=dev-python/pyyaml-3.13[${PYTHON_USEDEP}] )"
+BDEPEND="
+	test? (
+		>=dev-python/scipy-1.1.0[${PYTHON_USEDEP}]
+	)"
+
+distutils_enable_tests pytest
+
+src_test() {
+	virtx distutils-r1_src_test
+}
+
+python_install_all() {
+	use examples && dodoc -r examples
+
+	distutils-r1_python_install_all
+}
diff --git a/sys-apps/selinux-python/Manifest b/sys-apps/selinux-python/Manifest
new file mode 100644
index 0000000..166eed4
--- /dev/null
+++ b/sys-apps/selinux-python/Manifest
@@ -0,0 +1 @@
+DIST selinux-python-3.0.tar.gz 2100098 BLAKE2B 6949911020139378e9bdcc2b7c01c067ddaf71394a0a143a096d5708c5e7caa468b12826965c02af0b994f35d26c573187bf67c8d1ce75f5e8a31a1fb0fc6562 SHA512 743df60a643477465e4355880c56813ea8539415ea7c9631fb9b7cd7969a37cce572a6a94b785065d92baf9d7b6c753daa5d2f9709df7c9203c7effba46d58f2
diff --git a/sys-apps/selinux-python/metadata.xml b/sys-apps/selinux-python/metadata.xml
new file mode 100644
index 0000000..74f36a3
--- /dev/null
+++ b/sys-apps/selinux-python/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="project">
+		<email>selinux@gentoo.org</email>
+		<name>SELinux Team</name>
+	</maintainer>
+	<longdescription>
+		selinux-python contains the core python selinux utilities and libraries
+		that are required for basic operation of a SELinux system. These
+		include semanage, sepolicy and sepolgen.
+	</longdescription>
+	<upstream>
+		<remote-id type="github">SELinuxProject/selinux</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/sys-apps/selinux-python/selinux-python-3.0.ebuild b/sys-apps/selinux-python/selinux-python-3.0.ebuild
new file mode 100644
index 0000000..616e760
--- /dev/null
+++ b/sys-apps/selinux-python/selinux-python-3.0.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+PYTHON_COMPAT=( python{3_6,3_7} )
+PYTHON_REQ_USE="xml"
+
+inherit python-r1 toolchain-funcs
+
+MY_P="${P//_/-}"
+
+MY_RELEASEDATE="20191204"
+SEPOL_VER="${PV}"
+SELNX_VER="${PV}"
+SEMNG_VER="${PV}"
+
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DESCRIPTION="SELinux core utilities"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+
+if [[ ${PV} == 9999 ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
+	S="${WORKDIR}/${MY_P}/${PN#selinux-}"
+else
+	SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_RELEASEDATE}/${MY_P}.tar.gz"
+	KEYWORDS="*"
+	S="${WORKDIR}/${MY_P}"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=sys-libs/libselinux-${SELNX_VER}:=[python]
+	>=sys-libs/libsemanage-${SEMNG_VER}:=[python(+)]
+	>=sys-libs/libsepol-${SEPOL_VER}:=
+	>=app-admin/setools-4.2.0[${PYTHON_USEDEP}]
+	dev-python/ipy[${PYTHON_USEDEP}]
+	!dev-python/sepolgen
+	${PYTHON_DEPS}"
+
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	default
+	sed -i 's/-Werror//g' "${S}"/*/Makefile || die "Failed to remove Werror"
+
+	python_copy_sources
+}
+
+src_compile() {
+	building() {
+		emake -C "${BUILD_DIR}" \
+			CC="$(tc-getCC)" \
+			LIBDIR="\$(PREFIX)/$(get_libdir)"
+	}
+	python_foreach_impl building
+}
+
+src_install() {
+	installation() {
+		emake -C "${BUILD_DIR}" \
+			DESTDIR="${D}" \
+			LIBDIR="\$(PREFIX)/$(get_libdir)" \
+			install
+		python_optimize
+	}
+	python_foreach_impl installation
+
+	# Set version-specific scripts
+	for pyscript in audit2allow sepolgen-ifgen sepolicy chcat; do
+		python_replicate_script "${ED}/usr/bin/${pyscript}"
+	done
+	for pyscript in semanage; do
+		python_replicate_script "${ED}/usr/sbin/${pyscript}"
+	done
+
+	# Create sepolgen.conf with different devel location definition
+	if [[ -f /etc/selinux/config ]];
+	then
+		local selinuxtype=$(awk -F'=' '/^SELINUXTYPE/ {print $2}' /etc/selinux/config);
+		mkdir -p "${D}"/etc/selinux || die "Failed to create selinux directory";
+		echo "SELINUX_DEVEL_PATH=/usr/share/selinux/${selinuxtype}/include:/usr/share/selinux/${selinuxtype}" > "${D}"/etc/selinux/sepolgen.conf;
+	else
+		local selinuxtype="${POLICY_TYPES%% *}";
+		if [[ -n "${selinuxtype}" ]];
+		then
+			echo "SELINUX_DEVEL_PATH=/usr/share/selinux/${selinuxtype}/include:/usr/share/selinux/${selinuxtype}" > "${D}"/etc/selinux/sepolgen.conf;
+		else
+			echo "SELINUX_DEVEL_PATH=/usr/share/selinux/strict/include:/usr/share/selinux/strict" > "${D}"/etc/selinux/sepolgen.conf;
+		fi
+	fi
+}
diff --git a/sys-libs/libsemanage/Manifest b/sys-libs/libsemanage/Manifest
new file mode 100644
index 0000000..7efce6e
--- /dev/null
+++ b/sys-libs/libsemanage/Manifest
@@ -0,0 +1 @@
+DIST libsemanage-3.0.tar.gz 180745 BLAKE2B a7e7f0c98e365fcc132e2e66de736db29b46599be2da227dbf1384110a607120f141975b859e55073f734e3ff533bdf90b7bbefd79f7bc5857bbb0722a75ad4e SHA512 f960e1bd6815d3c9f000efa7ae717bc7937e742af5a7fea4aa865cf1aee49486e34897d83dbdb9cf77975a09a5ad77e5512d47690a74512a468a89432b72a42c
diff --git a/sys-libs/libsemanage/libsemanage-3.0.ebuild b/sys-libs/libsemanage/libsemanage-3.0.ebuild
new file mode 100644
index 0000000..3ee6f27
--- /dev/null
+++ b/sys-libs/libsemanage/libsemanage-3.0.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+PYTHON_COMPAT=( python{3_6,3_7,3_8} )
+
+inherit multilib python-r1 toolchain-funcs multilib-minimal
+
+MY_P="${P//_/-}"
+MY_RELEASEDATE="20191204"
+
+SEPOL_VER="${PV}"
+SELNX_VER="${PV}"
+
+DESCRIPTION="SELinux kernel and policy management library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
+	S="${WORKDIR}/${MY_P}/${PN}"
+else
+	SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_RELEASEDATE}/${MY_P}.tar.gz"
+	KEYWORDS="*"
+	S="${WORKDIR}/${MY_P}"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="python"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+	>=sys-libs/libselinux-${SELNX_VER}[${MULTILIB_USEDEP}]
+	>=sys-process/audit-2.2.2[${MULTILIB_USEDEP}]
+	>=dev-libs/ustr-1.0.4-r2[${MULTILIB_USEDEP}]
+	python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+	sys-devel/bison
+	sys-devel/flex
+	python? (
+		>=dev-lang/swig-2.0.4-r1
+		virtual/pkgconfig
+	)"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+	eapply_user
+
+	echo >> "${S}/src/semanage.conf"
+	echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
+	echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
+	echo "# or debugging of policy." >> "${S}/src/semanage.conf"
+	echo "save-linked=false" >> "${S}/src/semanage.conf"
+	echo >> "${S}/src/semanage.conf"
+	echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
+	echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
+	echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
+	echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
+	echo "# would catch." >> "${S}/src/semanage.conf"
+	echo "expand-check=1" >> "${S}/src/semanage.conf"
+	echo >> "${S}/src/semanage.conf"
+	echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
+	echo "# with bzip2.  Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
+	echo "# 1-9 when compressing.  The higher the number," >> "${S}/src/semanage.conf"
+	echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
+	echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
+	echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
+	echo >> "${S}/src/semanage.conf"
+	echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
+	echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
+	echo "bzip-small=true" >> "${S}/src/semanage.conf"
+
+	multilib_copy_sources
+}
+
+multilib_src_compile() {
+	emake \
+		AR="$(tc-getAR)" \
+		CC="$(tc-getCC)" \
+		LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+		all
+
+	if multilib_is_native_abi && use python; then
+		building_py() {
+			emake \
+				AR="$(tc-getAR)" \
+				CC="$(tc-getCC)" \
+				PKG_CONFIG="$(tc-getPKG_CONFIG)" \
+				LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+				"$@"
+		}
+		python_foreach_impl building_py swigify
+		python_foreach_impl building_py pywrap
+	fi
+}
+
+multilib_src_install() {
+	emake \
+		LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+		DESTDIR="${ED}" install
+
+	if multilib_is_native_abi && use python; then
+		installation_py() {
+			emake DESTDIR="${ED}" \
+				LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+				PKG_CONFIG="$(tc-getPKG_CONFIG)" \
+				install-pywrap
+			python_optimize # bug 531638
+		}
+		python_foreach_impl installation_py
+	fi
+}
+
+pkg_postinst() {
+	# Migrate the SELinux semanage configuration store if not done already
+	local selinuxtype=$(awk -F'=' '/SELINUXTYPE=/ {print $2}' "${EROOT}"/etc/selinux/config 2>/dev/null)
+	if [ -n "${selinuxtype}" ] && [ ! -d "${EROOT}"/var/lib/selinux/${selinuxtype}/active ] ; then
+		ewarn "Since the 2.4 SELinux userspace, the policy module store is moved"
+		ewarn "from /etc/selinux to /var/lib/selinux. The migration will be run now."
+		ewarn "If there are any issues, it can be done manually by running:"
+		ewarn "/usr/libexec/selinux/semanage_migrate_store"
+		ewarn "For more information, please see"
+		ewarn "- https://github.com/SELinuxProject/selinux/wiki/Policy-Store-Migration"
+	fi
+
+	# Run the store migration without rebuilds
+	for POLICY_TYPE in ${POLICY_TYPES} ; do
+		if [ ! -d "${EROOT}/var/lib/selinux/${POLICY_TYPE}/active" ] ; then
+			einfo "Migrating store ${POLICY_TYPE} (without policy rebuild)."
+			"${EROOT}/usr/libexec/selinux/semanage_migrate_store" -n -s "${POLICY_TYPE}" || ewarn "Failed to migrate store ${POLICY_TYPE}"
+		fi
+	done
+}
diff --git a/sys-libs/libsemanage/metadata.xml b/sys-libs/libsemanage/metadata.xml
new file mode 100644
index 0000000..9a9681c
--- /dev/null
+++ b/sys-libs/libsemanage/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="project">
+		<email>selinux@gentoo.org</email>
+		<name>SELinux Team</name>
+	</maintainer>
+	<upstream>
+		<remote-id type="github">SELinuxProject/selinux</remote-id>
+	</upstream>
+</pkgmetadata>