summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/Makefile.master5
-rw-r--r--usr/src/Targetdirs69
-rw-r--r--usr/src/cmd/pyzfs/pyzfs.py5
-rw-r--r--usr/src/lib/pylibbe/Makefile7
-rw-r--r--usr/src/lib/pylibbe/Makefile.com15
-rw-r--r--usr/src/lib/pylibbe/common/libbe_py.c66
-rw-r--r--usr/src/lib/pylibbe/common/mapfile-py347
-rw-r--r--usr/src/lib/pylibbe/py3/Makefile28
-rw-r--r--usr/src/lib/pysolaris/Makefile8
-rw-r--r--usr/src/lib/pysolaris/Makefile.com21
-rw-r--r--usr/src/lib/pysolaris/amd64/Makefile23
-rw-r--r--usr/src/lib/pysolaris/common/mapfile-py347
-rw-r--r--usr/src/lib/pysolaris/common/misc.c36
-rw-r--r--usr/src/lib/pysolaris/i386/Makefile4
-rw-r--r--usr/src/lib/pysolaris/py3/Makefile37
-rw-r--r--usr/src/lib/pyzfs/Makefile8
-rw-r--r--usr/src/lib/pyzfs/Makefile.com24
-rw-r--r--usr/src/lib/pyzfs/amd64/Makefile21
-rw-r--r--usr/src/lib/pyzfs/common/allow.py12
-rw-r--r--usr/src/lib/pyzfs/common/dataset.py21
-rw-r--r--usr/src/lib/pyzfs/common/holds.py7
-rw-r--r--usr/src/lib/pyzfs/common/ioctl.c61
-rw-r--r--usr/src/lib/pyzfs/common/mapfile-py347
-rw-r--r--usr/src/lib/pyzfs/common/table.py5
-rw-r--r--usr/src/lib/pyzfs/common/userspace.py5
-rw-r--r--usr/src/lib/pyzfs/common/util.py5
-rw-r--r--usr/src/lib/pyzfs/i386/Makefile4
-rw-r--r--usr/src/lib/pyzfs/py3/Makefile39
-rw-r--r--usr/src/pkg/Makefile44
-rw-r--r--usr/src/pkg/manifests/install-beadm.mf11
-rw-r--r--usr/src/pkg/manifests/system-file-system-zfs.mf34
-rw-r--r--usr/src/pkg/manifests/system-library-python-libbe-2.mf41
-rw-r--r--usr/src/pkg/manifests/system-library-python-libbe-3.mf38
-rw-r--r--usr/src/pkg/manifests/system-library-python-solaris-2.mf47
-rw-r--r--usr/src/pkg/manifests/system-library-python-solaris-3.mf45
-rw-r--r--usr/src/pkg/manifests/system-library-python-zfs-2.mf79
-rw-r--r--usr/src/pkg/manifests/system-library-python-zfs-3.mf78
-rw-r--r--usr/src/pkg/manifests/system-library.mf10
-rw-r--r--usr/src/tools/env/illumos.sh21
39 files changed, 957 insertions, 168 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index e23b888d46..e706a75789 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -193,7 +193,12 @@ PERL_ARCH = i86pc-solaris-64int
$(SPARC_BLD)PERL_ARCH = sun4-solaris-64int
PYTHON_VERSION= 2.7
PYTHON_PKGVERS= -27
+PYTHON_SUFFIX=
PYTHON= /usr/bin/python$(PYTHON_VERSION)
+PYTHON3_VERSION= 3.5
+PYTHON3_PKGVERS= -35
+PYTHON3_SUFFIX= m
+PYTHON3= /usr/bin/python$(PYTHON3_VERSION)
SORT= /usr/bin/sort
TOUCH= /usr/bin/touch
WC= /usr/bin/wc
diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs
index 25d0a14e02..b3705b47c9 100644
--- a/usr/src/Targetdirs
+++ b/usr/src/Targetdirs
@@ -28,6 +28,7 @@
# Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
# Copyright 2016 Nexenta Systems, Inc.
# Copyright 2017 RackTop Systems.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
#
@@ -65,6 +66,29 @@ sparc_64ONLY= $(POUND_SIGN)
$(64ONLY) MACH32_DIRS=/usr/ucb/$(MACH32)
+PYTHON2_DIRS=
+PYTHON2_64DIRS=
+PYTHON3_DIRS=
+
+$(BUILDPY2)PYTHON2_DIRS += \
+ /usr/lib/python$(PYTHON_VERSION) \
+ /usr/lib/python$(PYTHON_VERSION)/vendor-packages \
+ /usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris \
+ /usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs
+
+$(BUILDPY2)PYTHON2_64DIRS += \
+ /usr/lib/python$(PYTHON_VERSION)/vendor-packages/64 \
+ /usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/64 \
+ /usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/64
+
+$(BUILDPY3)PYTHON3_DIRS += \
+ /usr/lib/python$(PYTHON3_VERSION) \
+ /usr/lib/python$(PYTHON3_VERSION)/vendor-packages \
+ /usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris \
+ /usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris/__pycache__ \
+ /usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs \
+ /usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__
+
DIRS= \
/boot \
/boot/solaris \
@@ -282,12 +306,7 @@ DIRS= \
/usr/net \
/usr/net/servers \
/usr/lib/pool \
- /usr/lib/python$(PYTHON_VERSION) \
- /usr/lib/python$(PYTHON_VERSION)/vendor-packages \
- /usr/lib/python$(PYTHON_VERSION)/vendor-packages/64 \
- /usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris \
- /usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs \
- /usr/lib/python$(PYTHON_VERSION)/vendor-packages/beadm \
+ $(PYTHON2_DIRS) \
/usr/lib/rcap \
/usr/lib/rcap/$(MACH32) \
/usr/lib/sa \
@@ -456,6 +475,8 @@ DIRS64= \
/usr/lib/lwp/$(MACH64) \
/usr/lib/mdb/kvm/$(MACH64) \
/usr/lib/mdb/proc/$(MACH64) \
+ $(PYTHON2_64DIRS) \
+ $(PYTHON3_DIRS) \
/usr/lib/rcap/$(MACH64) \
/usr/lib/sasl/$(MACH64) \
/usr/lib/scsi/$(MACH64) \
@@ -640,28 +661,28 @@ $(DIRLINKS:%=$(ROOT)%):= \
# Special symlinks to populate usr/ccs/lib, whose objects
# have actually been moved to usr/lib
# Rather than adding another set of rules, we add usr/lib/lwp files here
-$(ROOT)/usr/ccs/lib/libcurses.so:= REALPATH=../../../lib/libcurses.so.1
-$(ROOT)/usr/ccs/lib/llib-lcurses:= REALPATH=../../../lib/llib-lcurses
-$(ROOT)/usr/ccs/lib/llib-lcurses.ln:= REALPATH=../../../lib/llib-lcurses.ln
+$(ROOT)/usr/ccs/lib/libcurses.so:= REALPATH=../../../lib/libcurses.so.1
+$(ROOT)/usr/ccs/lib/llib-lcurses:= REALPATH=../../../lib/llib-lcurses
+$(ROOT)/usr/ccs/lib/llib-lcurses.ln:= REALPATH=../../../lib/llib-lcurses.ln
$(ROOT)/usr/ccs/lib/libform.so:= REALPATH=../../lib/libform.so.1
-$(ROOT)/usr/ccs/lib/llib-lform:= REALPATH=../../lib/llib-lform
-$(ROOT)/usr/ccs/lib/llib-lform.ln:= REALPATH=../../lib/llib-lform.ln
+$(ROOT)/usr/ccs/lib/llib-lform:= REALPATH=../../lib/llib-lform
+$(ROOT)/usr/ccs/lib/llib-lform.ln:= REALPATH=../../lib/llib-lform.ln
$(ROOT)/usr/ccs/lib/libgen.so:= REALPATH=../../../lib/libgen.so.1
-$(ROOT)/usr/ccs/lib/llib-lgen:= REALPATH=../../../lib/llib-lgen
-$(ROOT)/usr/ccs/lib/llib-lgen.ln:= REALPATH=../../../lib/llib-lgen.ln
+$(ROOT)/usr/ccs/lib/llib-lgen:= REALPATH=../../../lib/llib-lgen
+$(ROOT)/usr/ccs/lib/llib-lgen.ln:= REALPATH=../../../lib/llib-lgen.ln
$(ROOT)/usr/ccs/lib/libmalloc.so:= REALPATH=../../lib/libmalloc.so.1
$(ROOT)/usr/ccs/lib/libmenu.so:= REALPATH=../../lib/libmenu.so.1
-$(ROOT)/usr/ccs/lib/llib-lmenu:= REALPATH=../../lib/llib-lmenu
-$(ROOT)/usr/ccs/lib/llib-lmenu.ln:= REALPATH=../../lib/llib-lmenu.ln
+$(ROOT)/usr/ccs/lib/llib-lmenu:= REALPATH=../../lib/llib-lmenu
+$(ROOT)/usr/ccs/lib/llib-lmenu.ln:= REALPATH=../../lib/llib-lmenu.ln
$(ROOT)/usr/ccs/lib/libpanel.so:= REALPATH=../../lib/libpanel.so.1
-$(ROOT)/usr/ccs/lib/llib-lpanel:= REALPATH=../../lib/llib-lpanel
-$(ROOT)/usr/ccs/lib/llib-lpanel.ln:= REALPATH=../../lib/llib-lpanel.ln
+$(ROOT)/usr/ccs/lib/llib-lpanel:= REALPATH=../../lib/llib-lpanel
+$(ROOT)/usr/ccs/lib/llib-lpanel.ln:= REALPATH=../../lib/llib-lpanel.ln
$(ROOT)/usr/ccs/lib/libtermlib.so:= REALPATH=../../../lib/libcurses.so.1
-$(ROOT)/usr/ccs/lib/llib-ltermlib:= REALPATH=../../../lib/llib-lcurses
-$(ROOT)/usr/ccs/lib/llib-ltermlib.ln:= REALPATH=../../../lib/llib-lcurses.ln
+$(ROOT)/usr/ccs/lib/llib-ltermlib:= REALPATH=../../../lib/llib-lcurses
+$(ROOT)/usr/ccs/lib/llib-ltermlib.ln:= REALPATH=../../../lib/llib-lcurses.ln
$(ROOT)/usr/ccs/lib/libtermcap.so:= REALPATH=../../../lib/libtermcap.so.1
-$(ROOT)/usr/ccs/lib/llib-ltermcap:= REALPATH=../../../lib/llib-ltermcap
-$(ROOT)/usr/ccs/lib/llib-ltermcap.ln:= REALPATH=../../../lib/llib-ltermcap.ln
+$(ROOT)/usr/ccs/lib/llib-ltermcap:= REALPATH=../../../lib/llib-ltermcap
+$(ROOT)/usr/ccs/lib/llib-ltermcap.ln:= REALPATH=../../../lib/llib-ltermcap.ln
$(ROOT)/usr/ccs/lib/values-Xa.o:= REALPATH=../../lib/values-Xa.o
$(ROOT)/usr/ccs/lib/values-Xc.o:= REALPATH=../../lib/values-Xc.o
$(ROOT)/usr/ccs/lib/values-Xs.o:= REALPATH=../../lib/values-Xs.o
@@ -669,9 +690,9 @@ $(ROOT)/usr/ccs/lib/values-Xt.o:= REALPATH=../../lib/values-Xt.o
$(ROOT)/usr/ccs/lib/values-xpg4.o:= REALPATH=../../lib/values-xpg4.o
$(ROOT)/usr/ccs/lib/values-xpg6.o:= REALPATH=../../lib/values-xpg6.o
$(ROOT)/usr/ccs/lib/libl.so:= REALPATH=../../lib/libl.so.1
-$(ROOT)/usr/ccs/lib/llib-ll.ln:= REALPATH=../../lib/llib-ll.ln
+$(ROOT)/usr/ccs/lib/llib-ll.ln:= REALPATH=../../lib/llib-ll.ln
$(ROOT)/usr/ccs/lib/liby.so:= REALPATH=../../lib/liby.so.1
-$(ROOT)/usr/ccs/lib/llib-ly.ln:= REALPATH=../../lib/llib-ly.ln
+$(ROOT)/usr/ccs/lib/llib-ly.ln:= REALPATH=../../lib/llib-ly.ln
$(ROOT)/usr/lib/lwp/libthread.so.1:= REALPATH=../libthread.so.1
$(ROOT)/usr/lib/lwp/libthread_db.so.1:= REALPATH=../libthread_db.so.1
@@ -1683,7 +1704,7 @@ SYM.USRLIB= \
/usr/lib/fm/llib-lfmevent \
/usr/lib/fm/llib-lfmevent.ln
-sparcv9_SYM.USRLIB64=
+sparcv9_SYM.USRLIB64=
amd64_SYM.USRLIB64= \
/usr/lib/amd64/libfdisk.so \
diff --git a/usr/src/cmd/pyzfs/pyzfs.py b/usr/src/cmd/pyzfs/pyzfs.py
index 03f29062d0..7df7d09bfe 100644
--- a/usr/src/cmd/pyzfs/pyzfs.py
+++ b/usr/src/cmd/pyzfs/pyzfs.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
# Note, we want SIGINT (control-c) to exit the process quietly, to mimic
@@ -65,11 +66,11 @@ try:
try:
subfunc()
- except zfs.util.ZFSError, e:
+ except zfs.util.ZFSError as e:
print(e)
sys.exit(1)
-except IOError, e:
+except IOError as e:
import errno
import sys
diff --git a/usr/src/lib/pylibbe/Makefile b/usr/src/lib/pylibbe/Makefile
index ee2a576b8a..670615ee8c 100644
--- a/usr/src/lib/pylibbe/Makefile
+++ b/usr/src/lib/pylibbe/Makefile
@@ -22,12 +22,15 @@
#
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
include ../Makefile.lib
-SUBDIRS= $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
+SUBDIRS=
+$(BUILDPY2)SUBDIRS += $(MACH)
+$(BUILD64)$(BUILDPY2)SUBDIRS += $(MACH64)
+$(BUILD64)$(BUILDPY3)SUBDIRS += py3
XGETTEXT= $(GNUXGETTEXT)
XGETFLAGS= $(GNUXGETFLAGS)
diff --git a/usr/src/lib/pylibbe/Makefile.com b/usr/src/lib/pylibbe/Makefile.com
index 3a2d866213..431bcfea1c 100644
--- a/usr/src/lib/pylibbe/Makefile.com
+++ b/usr/src/lib/pylibbe/Makefile.com
@@ -22,6 +22,7 @@
#
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
LIBRARY = libbe_py.a
@@ -30,12 +31,11 @@ OBJECTS = libbe_py.o
include ../../Makefile.lib
-LIBLINKS =
+LIBLINKS =
SRCDIR = ../common
ROOTLIBDIR= $(ROOT)/usr/lib/python$(PYTHON_VERSION)/vendor-packages
ROOTLIBDIR64= $(ROOT)/usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
-PYOBJS= $(PYSRCS:%.py=$(SRCDIR)/%.pyc)
-PYFILES= $(PYSRCS) $(PYSRCS:%.py=%.pyc)
+PYFILES= $(PYSRCS)
ROOTPYBEFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
CSTD= $(CSTD_GNU99)
@@ -43,20 +43,17 @@ CSTD= $(CSTD_GNU99)
LIBS = $(DYNLIB)
LDLIBS += -lbe -lnvpair -lc
CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/python$(PYTHON_VERSION) \
- -D_FILE_OFFSET_BITS=64 -I../../libbe/common
+CPPFLAGS += -D_FILE_OFFSET_BITS=64 -I../../libbe/common \
+ -I$(ADJUNCT_PROTO)/usr/include/python$(PYTHON_VERSION)$(PYTHON_SUFFIX)
.KEEP_STATE:
-all install := LDLIBS += -lpython$(PYTHON_VERSION)
+all install := LDLIBS += -lpython$(PYTHON_VERSION)$(PYTHON_SUFFIX)
all: $(PYOBJS) $(LIBS)
install: all $(ROOTPYBEFILES)
-$(ROOTLIBDIR)/%: %
- $(INS.pyfile)
-
lint: lintcheck
include ../../Makefile.targ
diff --git a/usr/src/lib/pylibbe/common/libbe_py.c b/usr/src/lib/pylibbe/common/libbe_py.c
index fb5102bdb6..3b4a3a3c42 100644
--- a/usr/src/lib/pylibbe/common/libbe_py.c
+++ b/usr/src/lib/pylibbe/common/libbe_py.c
@@ -60,7 +60,6 @@ PyObject *beUnmount(PyObject *, PyObject *);
PyObject *bePrintErrors(PyObject *, PyObject *);
PyObject *beGetErrDesc(PyObject *, PyObject *);
char *beMapLibbePyErrorToString(int);
-void initlibbe_py();
static boolean_t convertBEInfoToDictionary(be_node_list_t *be,
PyObject **listDict);
@@ -204,8 +203,8 @@ beCopy(PyObject *self, PyObject *args)
}
while (PyDict_Next(beNameProperties, &pos, &pkey, &pvalue)) {
if (!convertPyArgsToNvlist(&beProps, 2,
- PyString_AsString(pkey),
- PyString_AsString(pvalue))) {
+ PyBytes_AS_STRING(pkey),
+ PyBytes_AS_STRING(pvalue))) {
nvlist_free(beProps);
nvlist_free(beAttrs);
return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
@@ -833,21 +832,21 @@ convertBEInfoToDictionary(be_node_list_t *be, PyObject **listDict)
{
if (be->be_node_name != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_ORIG_BE_NAME,
- PyString_FromString(be->be_node_name)) != 0) {
+ PyUnicode_FromString(be->be_node_name)) != 0) {
return (B_FALSE);
}
}
if (be->be_rpool != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_ORIG_BE_POOL,
- PyString_FromString(be->be_rpool)) != 0) {
+ PyUnicode_FromString(be->be_rpool)) != 0) {
return (B_FALSE);
}
}
if (be->be_mntpt != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_MOUNTPOINT,
- PyString_FromString(be->be_mntpt)) != 0) {
+ PyUnicode_FromString(be->be_mntpt)) != 0) {
return (B_FALSE);
}
}
@@ -881,7 +880,7 @@ convertBEInfoToDictionary(be_node_list_t *be, PyObject **listDict)
if (be->be_root_ds != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_ROOT_DS,
- PyString_FromString(be->be_root_ds)) != 0) {
+ PyUnicode_FromString(be->be_root_ds)) != 0) {
return (B_FALSE);
}
}
@@ -895,14 +894,14 @@ convertBEInfoToDictionary(be_node_list_t *be, PyObject **listDict)
if (be->be_policy_type != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_POLICY,
- PyString_FromString(be->be_policy_type)) != 0) {
+ PyUnicode_FromString(be->be_policy_type)) != 0) {
return (B_FALSE);
}
}
if (be->be_uuid_str != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_UUID_STR,
- PyString_FromString(be->be_uuid_str)) != 0) {
+ PyUnicode_FromString(be->be_uuid_str)) != 0) {
return (B_FALSE);
}
}
@@ -915,7 +914,7 @@ convertDatasetInfoToDictionary(be_dataset_list_t *ds, PyObject **listDict)
{
if (ds->be_dataset_name != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_DATASET,
- PyString_FromString(ds->be_dataset_name)) != 0) {
+ PyUnicode_FromString(ds->be_dataset_name)) != 0) {
return (B_FALSE);
}
}
@@ -927,7 +926,7 @@ convertDatasetInfoToDictionary(be_dataset_list_t *ds, PyObject **listDict)
if (ds->be_ds_mntpt != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_MOUNTPOINT,
- PyString_FromString(ds->be_ds_mntpt)) != 0) {
+ PyUnicode_FromString(ds->be_ds_mntpt)) != 0) {
return (B_FALSE);
}
}
@@ -947,14 +946,14 @@ convertDatasetInfoToDictionary(be_dataset_list_t *ds, PyObject **listDict)
if (ds->be_dataset_name != 0) {
if (PyDict_SetItemString(*listDict, BE_ATTR_DATASET,
- PyString_FromString(ds->be_dataset_name)) != 0) {
+ PyUnicode_FromString(ds->be_dataset_name)) != 0) {
return (B_FALSE);
}
}
if (ds->be_ds_plcy_type != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_POLICY,
- PyString_FromString(ds->be_ds_plcy_type)) != 0) {
+ PyUnicode_FromString(ds->be_ds_plcy_type)) != 0) {
return (B_FALSE);
}
}
@@ -974,7 +973,7 @@ convertSnapshotInfoToDictionary(be_snapshot_list_t *ss, PyObject **listDict)
{
if (ss->be_snapshot_name != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_SNAP_NAME,
- PyString_FromString(ss->be_snapshot_name)) != 0) {
+ PyUnicode_FromString(ss->be_snapshot_name)) != 0) {
return (B_FALSE);
}
}
@@ -988,7 +987,7 @@ convertSnapshotInfoToDictionary(be_snapshot_list_t *ss, PyObject **listDict)
if (ss->be_snapshot_type != NULL) {
if (PyDict_SetItemString(*listDict, BE_ATTR_POLICY,
- PyString_FromString(ss->be_snapshot_type)) != 0) {
+ PyUnicode_FromString(ss->be_snapshot_type)) != 0) {
return (B_FALSE);
}
}
@@ -1103,9 +1102,42 @@ static struct PyMethodDef libbeMethods[] = {
{NULL, NULL, 0, NULL}
};
-void
-initlibbe_py()
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef libbe_module = {
+ PyModuleDef_HEAD_INIT,
+ "libbe_py",
+ NULL,
+ -1,
+ libbeMethods
+};
+#endif
+
+static PyObject *
+moduleinit()
{
/* PyMODINIT_FUNC; */
+#if PY_MAJOR_VERSION >= 3
+ return (PyModule_Create(&libbe_module));
+#else
+ /*
+ * Python2 module initialisation functions are void and may not return
+ * a value. However, they will set an exception if appropriate.
+ */
(void) Py_InitModule("libbe_py", libbeMethods);
+ return (NULL);
+#endif
+}
+
+#if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC
+PyInit_libbe_py(void)
+{
+ return (moduleinit());
+}
+#else
+PyMODINIT_FUNC
+initlibbe_py(void)
+{
+ (void) moduleinit();
}
+#endif
diff --git a/usr/src/lib/pylibbe/common/mapfile-py3 b/usr/src/lib/pylibbe/common/mapfile-py3
new file mode 100644
index 0000000000..ea39f9cfd8
--- /dev/null
+++ b/usr/src/lib/pylibbe/common/mapfile-py3
@@ -0,0 +1,47 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION SUNWprivate {
+ global:
+ PyInit_libbe_py;
+ local:
+ *;
+};
diff --git a/usr/src/lib/pylibbe/py3/Makefile b/usr/src/lib/pylibbe/py3/Makefile
new file mode 100644
index 0000000000..d146f8c62c
--- /dev/null
+++ b/usr/src/lib/pylibbe/py3/Makefile
@@ -0,0 +1,28 @@
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+# CDDL HEADER END
+
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+PYTHON = $(PYTHON3)
+PYTHON_VERSION = $(PYTHON3_VERSION)
+PYTHON_SUFFIX = $(PYTHON3_SUFFIX)
+LDLIBS64 += -L$(ADJUNCT_PROTO)/usr/lib/$(MACH64)
+MAPFILES = $(SRCDIR)/mapfile-py3
+$(ROOTLIBDIR)/$(DYNLIB) := FILEMODE= 755
+
+$(ROOTLIBS):
+ $(INS.file) $(DYNLIB)
+
+install: all $(ROOTLIBS)
diff --git a/usr/src/lib/pysolaris/Makefile b/usr/src/lib/pysolaris/Makefile
index df3d21faa4..2c588428c3 100644
--- a/usr/src/lib/pysolaris/Makefile
+++ b/usr/src/lib/pysolaris/Makefile
@@ -21,11 +21,15 @@
#
# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
include ../Makefile.lib
-SUBDIRS= $(MACH)
+SUBDIRS=
+$(BUILDPY2)SUBDIRS += $(MACH)
+$(BUILD64)$(BUILDPY2)SUBDIRS += $(MACH64)
+$(BUILD64)$(BUILDPY3)SUBDIRS += py3
all := TARGET= all
install := TARGET= install
@@ -34,7 +38,7 @@ clobber := TARGET= clobber
lint := TARGET= lint
PYCFIND = $(FIND) . -name '*.pyc'
-PYCFILES = $(PYCFIND:sh)
+PYCFILES = $(PYCFIND:sh)
.KEEP_STATE:
diff --git a/usr/src/lib/pysolaris/Makefile.com b/usr/src/lib/pysolaris/Makefile.com
index 82bf87d09b..69769ae544 100644
--- a/usr/src/lib/pysolaris/Makefile.com
+++ b/usr/src/lib/pysolaris/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
LIBRARY = misc.a
@@ -30,27 +31,27 @@ PYSRCS= __init__.py
include ../../Makefile.lib
-LIBLINKS =
+LIBLINKS =
SRCDIR = ../common
ROOTLIBDIR= $(ROOT)/usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris
+ROOTLIBDIR64= $(ROOTLIBDIR)/64
PYOBJS= $(PYSRCS:%.py=$(SRCDIR)/%.pyc)
PYFILES= $(PYSRCS) $(PYSRCS:%.py=%.pyc)
-ROOTPYSOLFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
+ROOTPYSOLFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
-CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
+CSTD= $(CSTD_GNU99)
+C99LMODE= -Xc99=%all
LIBS = $(DYNLIB)
-LDLIBS += -lc -lsec -lidmap -lpython$(PYTHON_VERSION)
+LDLIBS += -lc -lsec -lidmap -lpython$(PYTHON_VERSION)$(PYTHON_SUFFIX)
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-unused-variable
-CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/python$(PYTHON_VERSION)
+CPPFLAGS += \
+ -I$(ADJUNCT_PROTO)/usr/include/python$(PYTHON_VERSION)$(PYTHON_SUFFIX)
-.KEEP_STATE:
-
-all: $(PYOBJS) $(LIBS)
+all:
-install: all $(ROOTPYSOLFILES)
+.KEEP_STATE:
$(ROOTLIBDIR)/%: %
$(INS.pyfile)
diff --git a/usr/src/lib/pysolaris/amd64/Makefile b/usr/src/lib/pysolaris/amd64/Makefile
new file mode 100644
index 0000000000..4fa33a90bd
--- /dev/null
+++ b/usr/src/lib/pysolaris/amd64/Makefile
@@ -0,0 +1,23 @@
+#
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# CDDL HEADER END
+
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+all: $(LIBS)
+install: all $(ROOTLIBS64)
diff --git a/usr/src/lib/pysolaris/common/mapfile-py3 b/usr/src/lib/pysolaris/common/mapfile-py3
new file mode 100644
index 0000000000..6e14724a62
--- /dev/null
+++ b/usr/src/lib/pysolaris/common/mapfile-py3
@@ -0,0 +1,47 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION SUNWprivate {
+ global:
+ PyInit_misc;
+ local:
+ *;
+};
diff --git a/usr/src/lib/pysolaris/common/misc.c b/usr/src/lib/pysolaris/common/misc.c
index 13280d461f..211ab1b983 100644
--- a/usr/src/lib/pysolaris/common/misc.c
+++ b/usr/src/lib/pysolaris/common/misc.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
*/
#include <Python.h>
@@ -85,7 +86,7 @@ py_sid_to_name(PyObject *self, PyObject *args)
return (NULL);
}
- ret = PyString_FromString(name);
+ ret = PyUnicode_FromString(name);
free(name);
return (ret);
}
@@ -121,8 +122,37 @@ static PyMethodDef solarismethods[] = {
{NULL, NULL, 0, NULL}
};
-void
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef solaris_module = {
+ PyModuleDef_HEAD_INIT,
+ "solaris.misc",
+ NULL,
+ -1,
+ solarismethods
+};
+#endif
+
+static PyObject *
+moduleinit()
+{
+#if PY_MAJOR_VERSION >= 3
+ return (PyModule_Create(&solaris_module));
+#else
+ (void) Py_InitModule("solaris.misc", solarismethods);
+ return (NULL);
+#endif
+}
+
+#if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC
+PyInit_misc(void)
+{
+ return (moduleinit());
+}
+#else
+PyMODINIT_FUNC
initmisc(void)
{
- PyObject *solaris_misc = Py_InitModule("solaris.misc", solarismethods);
+ (void) moduleinit();
}
+#endif
diff --git a/usr/src/lib/pysolaris/i386/Makefile b/usr/src/lib/pysolaris/i386/Makefile
index cf68e8eb6d..926da3004e 100644
--- a/usr/src/lib/pysolaris/i386/Makefile
+++ b/usr/src/lib/pysolaris/i386/Makefile
@@ -20,8 +20,10 @@
#
# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
include ../Makefile.com
-install: all $(ROOTLIBS)
+all: $(PYOBJS) $(LIBS)
+install: all $(ROOTPYSOLFILES) $(ROOTLIBS)
diff --git a/usr/src/lib/pysolaris/py3/Makefile b/usr/src/lib/pysolaris/py3/Makefile
new file mode 100644
index 0000000000..700cc16ca5
--- /dev/null
+++ b/usr/src/lib/pysolaris/py3/Makefile
@@ -0,0 +1,37 @@
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# CDDL HEADER END
+
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+PYTHON = $(PYTHON3)
+PYTHON_VERSION = $(PYTHON3_VERSION)
+PYTHON_SUFFIX = $(PYTHON3_SUFFIX)
+
+LDLIBS64 += -L$(ADJUNCT_PROTO)/usr/lib/$(MACH64)
+MAPFILES= $(SRCDIR)/mapfile-py3
+ROOTPYSOLFILES= $(PYSRCS:%=$(ROOTLIBDIR)/%)
+$(ROOTLIBDIR)/$(DYNLIB) := FILEMODE= 755
+
+all: $(LIBS)
+install: all $(ROOTLIBS) $(ROOTPYSOLFILES)
+
+$(ROOTLIBDIR)/%.so: %.so
+ $(INS.file)
+
+$(ROOTLIBDIR)/%: ../common/%
+ $(INS.pyfile)
+ $(PYTHON) -mpy_compile $@
+
diff --git a/usr/src/lib/pyzfs/Makefile b/usr/src/lib/pyzfs/Makefile
index c69270f58f..2cf7b8a517 100644
--- a/usr/src/lib/pyzfs/Makefile
+++ b/usr/src/lib/pyzfs/Makefile
@@ -21,11 +21,15 @@
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
include ../Makefile.lib
-SUBDIRS= $(MACH)
+SUBDIRS=
+$(BUILDPY2)SUBDIRS += $(MACH)
+$(BUILD64)$(BUILDPY2)SUBDIRS += $(MACH64)
+$(BUILD64)$(BUILDPY3)SUBDIRS += py3
XGETTEXT= $(GNUXGETTEXT)
XGETFLAGS= $(GNUXGETFLAGS)
@@ -38,7 +42,7 @@ lint := TARGET= lint
MSGFIND = $(FIND) . -name '*.py' -o -name '*.c'
MSGFILES = $(MSGFIND:sh)
PYCFIND = $(FIND) . -name '*.pyc'
-PYCFILES = $(PYCFIND:sh)
+PYCFILES = $(PYCFIND:sh)
POFILE = pyzfs.po
.KEEP_STATE:
diff --git a/usr/src/lib/pyzfs/Makefile.com b/usr/src/lib/pyzfs/Makefile.com
index 59720a8334..347b4316eb 100644
--- a/usr/src/lib/pyzfs/Makefile.com
+++ b/usr/src/lib/pyzfs/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
LIBRARY = ioctl.a
@@ -27,15 +28,15 @@ VERS =
OBJECTS = ioctl.o
PYSRCS= __init__.py util.py dataset.py \
- allow.py unallow.py \
- userspace.py groupspace.py holds.py table.py
-
+ allow.py unallow.py \
+ userspace.py groupspace.py holds.py table.py
include ../../Makefile.lib
-LIBLINKS =
+LIBLINKS =
SRCDIR = ../common
ROOTLIBDIR= $(ROOT)/usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs
+ROOTLIBDIR64= $(ROOTLIBDIR)/64
PYOBJS= $(PYSRCS:%.py=$(SRCDIR)/%.pyc)
PYFILES= $(PYSRCS) $(PYSRCS:%.py=%.pyc)
ROOTPYZFSFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
@@ -44,18 +45,17 @@ CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LIBS = $(DYNLIB)
-LDLIBS += -lc -lnvpair -lpython$(PYTHON_VERSION) -lzfs
+LDLIBS += -lc -lnvpair -lpython$(PYTHON_VERSION)$(PYTHON_SUFFIX) -lzfs
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-unused-variable
-CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/python$(PYTHON_VERSION)
+CPPFLAGS += \
+ -I$(ADJUNCT_PROTO)/usr/include/python$(PYTHON_VERSION)$(PYTHON_SUFFIX)
CPPFLAGS += -I../../../uts/common/fs/zfs
CPPFLAGS += -I../../../common/zfs
.KEEP_STATE:
-all: $(PYOBJS) $(LIBS)
-
-install: all $(ROOTPYZFSFILES)
+all:
$(ROOTLIBDIR)/%: %
$(INS.pyfile)
@@ -63,6 +63,12 @@ $(ROOTLIBDIR)/%: %
$(ROOTLIBDIR)/%: ../common/%
$(INS.pyfile)
+$(ROOTLIBDIR64)/%: %
+ $(INS.pyfile)
+
+$(ROOTLIBDIR64)/%: ../common/%
+ $(INS.pyfile)
+
lint: lintcheck
include ../../Makefile.targ
diff --git a/usr/src/lib/pyzfs/amd64/Makefile b/usr/src/lib/pyzfs/amd64/Makefile
new file mode 100644
index 0000000000..f3fde27d22
--- /dev/null
+++ b/usr/src/lib/pyzfs/amd64/Makefile
@@ -0,0 +1,21 @@
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+# CDDL HEADER END
+
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+all: $(LIBS)
+install: all $(ROOTLIBS64)
diff --git a/usr/src/lib/pyzfs/common/allow.py b/usr/src/lib/pyzfs/common/allow.py
index 2c01280b4b..91d4834679 100644
--- a/usr/src/lib/pyzfs/common/allow.py
+++ b/usr/src/lib/pyzfs/common/allow.py
@@ -21,6 +21,7 @@
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
"""This module implements the "zfs allow" and "zfs unallow" subcommands.
@@ -146,7 +147,7 @@ def args_to_perms(parser, options, who, perms):
baseperms = None
d = dict()
-
+
def storeperm(typechr, inheritchr, arg):
assert typechr in "ugecs"
assert inheritchr in "ld-"
@@ -251,20 +252,20 @@ def canonicalized_perm(permname):
except KeyError:
raise zfs.util.ZFSError(errno.EINVAL, permname,
_("invalid permission"))
-
+
def print_perms():
"""Print the set of supported permissions."""
print(_("\nThe following permissions are supported:\n"))
fmt = "%-16s %-14s\t%s"
print(fmt % (_("NAME"), _("TYPE"), _("NOTES")))
- for (name, note) in sorted(perms_subcmd.iteritems()):
+ for (name, note) in sorted(perms_subcmd.items()):
print(fmt % (name, _("subcommand"), note))
- for (name, note) in sorted(perms_other.iteritems()):
+ for (name, note) in sorted(perms_other.items()):
print(fmt % (name, _("other"), note))
- for (name, prop) in sorted(zfs.dataset.proptable.iteritems()):
+ for (name, prop) in sorted(zfs.dataset.proptable.items()):
if prop.visible and prop.delegatable():
print(fmt % (name, _("property"), ""))
@@ -335,7 +336,6 @@ def do_allow():
print(s + "-" * (70-len(s)))
print(p[fs])
return
-
(options, args) = parser.parse_args(sys.argv[2:])
diff --git a/usr/src/lib/pyzfs/common/dataset.py b/usr/src/lib/pyzfs/common/dataset.py
index 9d4652235a..752449486f 100644
--- a/usr/src/lib/pyzfs/common/dataset.py
+++ b/usr/src/lib/pyzfs/common/dataset.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
"""Implements the Dataset class, providing methods for manipulating ZFS
@@ -69,7 +70,7 @@ class Property(object):
return self.attr != "readonly"
proptable = dict()
-for name, t in zfs.ioctl.get_proptable().iteritems():
+for name, t in zfs.ioctl.get_proptable().items():
proptable[name] = Property(t)
del name, t
@@ -79,7 +80,7 @@ def getpropobj(name):
try:
return proptable[name]
except KeyError:
- for p in proptable.itervalues():
+ for p in proptable.values():
if p.colname and p.colname.lower() == name:
return p
raise
@@ -90,7 +91,7 @@ class Dataset(object):
Generally, this class provides interfaces to the C functions in
zfs.ioctl which actually interface with the kernel to manipulate
datasets.
-
+
Unless otherwise noted, any method can raise a ZFSError to
indicate failure."""
@@ -101,7 +102,7 @@ class Dataset(object):
types=("filesystem", "volume"), snaps=True):
"""Open the named dataset, checking that it exists and
is of the specified type.
-
+
name is the string name of this dataset.
props is the property settings dict from zfs.ioctl.next_dataset.
@@ -137,7 +138,7 @@ class Dataset(object):
Currently only works for native properties (those with a
Property object.)
-
+
Raises KeyError if propname does not specify a native property.
Does not raise ZFSError.
"""
@@ -165,7 +166,7 @@ class Dataset(object):
yield ds
for child in ds.descendents():
yield child
-
+
def userspace(self, prop):
"""A generator function which iterates over a
userspace-type property.
@@ -177,14 +178,14 @@ class Dataset(object):
"""
d = zfs.ioctl.userspace_many(self.name, prop)
- for ((domain, rid), space) in d.iteritems():
+ for ((domain, rid), space) in d.items():
yield (domain, rid, space)
def userspace_upgrade(self):
"""Initialize the accounting information for
userused@... and groupused@... properties."""
return zfs.ioctl.userspace_upgrade(self.name)
-
+
def set_fsacl(self, un, d):
"""Add to the "zfs allow"-ed permissions on this Dataset.
@@ -219,7 +220,7 @@ def snapshots_fromcmdline(dsnames, recursive):
try:
ds = Dataset(dsname)
yield ds
- except zfs.util.ZFSError, e:
+ except zfs.util.ZFSError as e:
if not recursive or e.errno != errno.ENOENT:
raise
if recursive:
@@ -229,6 +230,6 @@ def snapshots_fromcmdline(dsnames, recursive):
try:
yield Dataset(child.name + "@" +
snapname)
- except zfs.util.ZFSError, e:
+ except zfs.util.ZFSError as e:
if e.errno != errno.ENOENT:
raise
diff --git a/usr/src/lib/pyzfs/common/holds.py b/usr/src/lib/pyzfs/common/holds.py
index 0a1508e76a..63645e329c 100644
--- a/usr/src/lib/pyzfs/common/holds.py
+++ b/usr/src/lib/pyzfs/common/holds.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
"""This module implements the "zfs holds" subcommand.
@@ -59,12 +60,12 @@ def do_holds():
fields = ("name", "tag", "timestamp")
rjustfields = ()
- printing = False
+ printing = False
gotone = False
- t = zfs.table.Table(fields, rjustfields)
+ t = zfs.table.Table(fields, rjustfields)
for ds in zfs.dataset.snapshots_fromcmdline(args, options.recursive):
gotone = True
- for tag, tm in ds.get_holds().iteritems():
+ for tag, tm in ds.get_holds().items():
val = {"name": ds.name, "tag": tag,
"timestamp": time.ctime(tm)}
t.addline(ds.name, val)
diff --git a/usr/src/lib/pyzfs/common/ioctl.c b/usr/src/lib/pyzfs/common/ioctl.c
index d8c0d18679..55c03fc2b8 100644
--- a/usr/src/lib/pyzfs/common/ioctl.c
+++ b/usr/src/lib/pyzfs/common/ioctl.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
*/
#include <Python.h>
@@ -131,7 +132,7 @@ dict2nvl(PyObject *d)
nvlist_t *nvl;
int err;
PyObject *key, *value;
- int pos = 0;
+ Py_ssize_t pos = 0;
if (!PyDict_Check(d)) {
PyErr_SetObject(PyExc_ValueError, d);
@@ -142,7 +143,11 @@ dict2nvl(PyObject *d)
assert(err == 0);
while (PyDict_Next(d, &pos, &key, &value)) {
+#if PY_MAJOR_VERSION >= 3
+ char *keystr = PyBytes_AsString(key);
+#else
char *keystr = PyString_AsString(key);
+#endif
if (keystr == NULL) {
PyErr_SetObject(PyExc_KeyError, key);
nvlist_free(nvl);
@@ -155,11 +160,19 @@ dict2nvl(PyObject *d)
nvlist_free(valnvl);
} else if (value == Py_None) {
err = nvlist_add_boolean(nvl, keystr);
+#if PY_MAJOR_VERSION >= 3
+ } else if (PyBytes_Check(value)) {
+#else
} else if (PyString_Check(value)) {
+#endif
+#if PY_MAJOR_VERSION >= 3
+ char *valstr = PyBytes_AsString(value);
+#else
char *valstr = PyString_AsString(value);
+#endif
err = nvlist_add_string(nvl, keystr, valstr);
- } else if (PyInt_Check(value)) {
- uint64_t valint = PyInt_AsUnsignedLongLongMask(value);
+ } else if (PyLong_Check(value)) {
+ uint64_t valint = PyLong_AsUnsignedLongLongMask(value);
err = nvlist_add_uint64(nvl, keystr, valint);
} else if (PyBool_Check(value)) {
boolean_t valbool = value == Py_True ? B_TRUE : B_FALSE;
@@ -525,19 +538,49 @@ static PyMethodDef zfsmethods[] = {
{NULL, NULL, 0, NULL}
};
-void
-initioctl(void)
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef zfs_module = {
+ PyModuleDef_HEAD_INIT,
+ "zfs.ioctl",
+ NULL,
+ -1,
+ zfsmethods
+};
+#endif
+
+static PyObject *
+moduleinit()
{
- PyObject *zfs_ioctl = Py_InitModule("zfs.ioctl", zfsmethods);
- PyObject *zfs_util = PyImport_ImportModule("zfs.util");
- PyObject *devfile;
+ PyObject *zfs_ioctl, *zfs_util, *devfile;
+#if PY_MAJOR_VERSION >= 3
+ zfs_ioctl = PyModule_Create(&zfs_module);
+#else
+ zfs_ioctl = Py_InitModule("zfs.ioctl", zfsmethods);
+#endif
+ zfs_util = PyImport_ImportModule("zfs.util");
if (zfs_util == NULL)
- return;
+ return (NULL);
ZFSError = PyObject_GetAttrString(zfs_util, "ZFSError");
devfile = PyObject_GetAttrString(zfs_util, "dev");
zfsdevfd = PyObject_AsFileDescriptor(devfile);
zfs_prop_init();
+
+ return (zfs_ioctl);
+}
+
+#if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC
+PyInit_ioctl(void)
+{
+ return (moduleinit());
}
+#else
+PyMODINIT_FUNC
+initioctl(void)
+{
+ (void) moduleinit();
+}
+#endif
diff --git a/usr/src/lib/pyzfs/common/mapfile-py3 b/usr/src/lib/pyzfs/common/mapfile-py3
new file mode 100644
index 0000000000..a45e760e01
--- /dev/null
+++ b/usr/src/lib/pyzfs/common/mapfile-py3
@@ -0,0 +1,47 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION SUNWprivate {
+ global:
+ PyInit_ioctl;
+ local:
+ *;
+};
diff --git a/usr/src/lib/pyzfs/common/table.py b/usr/src/lib/pyzfs/common/table.py
index 87aab1d6f1..173f06b5a0 100644
--- a/usr/src/lib/pyzfs/common/table.py
+++ b/usr/src/lib/pyzfs/common/table.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
import zfs.util
@@ -34,7 +35,7 @@ class Table:
self.rjustfields = rjustfields
self.maxfieldlen = dict.fromkeys(fields, 0)
self.lines = list()
-
+
def __updatemax(self, k, v):
self.maxfieldlen[k] = max(self.maxfieldlen.get(k, None), v)
@@ -46,6 +47,8 @@ class Table:
v = str(values[f])
va.append(v)
self.__updatemax(f, len(v))
+ if sortkey == None:
+ sortkey = []
self.lines.append((sortkey, va))
def printme(self, headers=True):
diff --git a/usr/src/lib/pyzfs/common/userspace.py b/usr/src/lib/pyzfs/common/userspace.py
index 79355e1e23..89cc18b241 100644
--- a/usr/src/lib/pyzfs/common/userspace.py
+++ b/usr/src/lib/pyzfs/common/userspace.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
"""This module implements the "zfs userspace" and "zfs groupspace" subcommands.
@@ -115,7 +116,7 @@ def process_one_raw(acct, options, prop, elem):
except KeyError:
pass;
key = (isgroup, domain, rid)
-
+
try:
v = acct[key]
except KeyError:
@@ -241,6 +242,6 @@ def do_userspace():
return l
t = zfs.table.Table(options.fields, rjustfields)
- for val in acct.itervalues():
+ for val in acct.values():
t.addline(cmpkey(val), val)
t.printme(not options.noheaders)
diff --git a/usr/src/lib/pyzfs/common/util.py b/usr/src/lib/pyzfs/common/util.py
index cfc21ac57c..f384501c11 100644
--- a/usr/src/lib/pyzfs/common/util.py
+++ b/usr/src/lib/pyzfs/common/util.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
"""This module provides utility functions for ZFS.
@@ -54,11 +55,11 @@ def default_repr(self):
return "<%s %s>" % \
(self.__class__.__name__, repr(self.__dict__))
-class ZFSError(StandardError):
+class ZFSError(Exception):
"""This exception class represents a potentially user-visible
ZFS error. If uncaught, it will be printed and the process will
exit with exit code 1.
-
+
errno -- the error number (eg, from ioctl(2))."""
__slots__ = "why", "task", "errno"
diff --git a/usr/src/lib/pyzfs/i386/Makefile b/usr/src/lib/pyzfs/i386/Makefile
index 4ce880c2ae..82d8120e69 100644
--- a/usr/src/lib/pyzfs/i386/Makefile
+++ b/usr/src/lib/pyzfs/i386/Makefile
@@ -20,8 +20,10 @@
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
include ../Makefile.com
-install: all $(ROOTLIBS)
+all: $(PBOJECT) $(LIBS)
+install: all $(ROOTPYZFSFILES) $(ROOTLIBS)
diff --git a/usr/src/lib/pyzfs/py3/Makefile b/usr/src/lib/pyzfs/py3/Makefile
new file mode 100644
index 0000000000..27e04f084e
--- /dev/null
+++ b/usr/src/lib/pyzfs/py3/Makefile
@@ -0,0 +1,39 @@
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# CDDL HEADER END
+
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+PYTHON = $(PYTHON3)
+PYTHON_VERSION = $(PYTHON3_VERSION)
+PYTHON_SUFFIX = $(PYTHON3_SUFFIX)
+
+LDLIBS64 += -L$(ADJUNCT_PROTO)/usr/lib/$(MACH64)
+MAPFILES= $(SRCDIR)/mapfile-py3
+ROOTPYZFSFILES= $(PYSRCS:%=$(ROOTLIBDIR)/%)
+$(ROOTLIBDIR)/$(DYNLIB) := FILEMODE= 755
+
+all: $(LIBS)
+install: all $(ROOTLIBS) $(ROOTPYZFSFILES)
+
+$(ROOTLIBDIR)/%.so: %.so
+ $(INS.file)
+
+$(ROOTLIBDIR)/%: ../common/%
+ $(INS.pyfile)
+ $(PYTHON) -mpy_compile $@
+
diff --git a/usr/src/pkg/Makefile b/usr/src/pkg/Makefile
index 28b315f22c..cacaa22aca 100644
--- a/usr/src/pkg/Makefile
+++ b/usr/src/pkg/Makefile
@@ -23,6 +23,7 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
include $(SRC)/Makefile.master
@@ -189,7 +190,11 @@ PKGMOG_DEFINES= \
PERL_VERSION=$(PERL_VERSION) \
PERL_PKGVERS=$(PERL_PKGVERS) \
PYTHON_VERSION=$(PYTHON_VERSION) \
+ PYTHON3_VERSION=$(PYTHON3_VERSION) \
PYTHON_PKGVERS=$(PYTHON_PKGVERS) \
+ PYTHON3_PKGVERS=$(PYTHON3_PKGVERS) \
+ python2_ONLY=$(BUILDPY2) \
+ python3_ONLY=$(BUILDPY3) \
JAVA_8_ONLY=$(JAVA_8_ONLY) \
JAVA_7_ONLY=$(JAVA_7_ONLY)
@@ -230,7 +235,28 @@ CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) install-$(PKGMACH).out \
# build environment and then reference (implicitly or explicitly) the all
# or install targets.
#
-MANIFESTS :sh= (cd manifests; print *.mf)
+# We want some manifests to optionally build based on environment options, so
+# those are excluded when generating the list of manifests and added back in if
+# necessary. We also want a relatively easy way to add files to the list of
+# manifests given special treatment. Add any other special ones to the
+# SPECIAL_MANIFESTS variable. It can contain wildcards in regexp form, i.e.
+# SUNW.* as one useful example.
+#
+SPECIAL_MANIFESTS = system-library-python-.*
+LIST_MANIFESTS_CMD = (cd manifests ; /usr/bin/ls -1 *.mf |\
+ $(SED) $(SPECIAL_MANIFESTS:%=-e '/^%$$/d') )
+MANIFESTS = $(LIST_MANIFESTS_CMD:sh)
+
+# Conditionally add back python modules
+$(BUILDPY2) MANIFESTS += \
+ system-library-python-libbe-2.mf \
+ system-library-python-solaris-2.mf \
+ system-library-python-zfs-2.mf
+$(BUILDPY3) MANIFESTS += \
+ system-library-python-libbe-3.mf \
+ system-library-python-solaris-3.mf \
+ system-library-python-zfs-3.mf
+
PKGS= $(MANIFESTS:%.mf=%)
DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
@@ -269,9 +295,9 @@ PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
#
# The meanings of each package status are as follows:
#
-# PKGSTAT meaning
-# ---------- ----------------------------------------------------
-# noincorp Do not include in incorporation or group package
+# PKGSTAT meaning
+# ---------- ----------------------------------------------------
+# noincorp Do not include in incorporation or group package
# obsolete Include in incorporation, but not group package
# renamed Include in incorporation, but not group package
# current Include in incorporation and group package
@@ -310,7 +336,7 @@ PKGLISTS= \
# | use pkgsend to publish the package
# |
# placeholder to indicate successful publication (mypkg.pub)
-#
+#
# * This may be suppressed via SUPPRESSPKGDEP. The resulting
# packages will install correctly, but care must be taken to
# install all dependencies, because pkg will not have the input
@@ -350,16 +376,16 @@ PKGLISTS= \
# | |
# | | pkgsend publish
# | |
-# repositories resolved dependencies
+# repositories resolved dependencies
# | |
# pkgsend | | pkgdepend resolve
-# create-repository |
+# create-repository |
# | generated dependencies
# repo directories |
# | pkgdepend
# |
# processed manifests
-#
+#
ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
@@ -685,7 +711,7 @@ protocmp: makesilent
pmodes: makesilent
@validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
- -e $(CODEMGR_WS)/exception_lists/pmodes
+ -e $(CODEMGR_WS)/exception_lists/pmodes
check: protocmp pmodes
diff --git a/usr/src/pkg/manifests/install-beadm.mf b/usr/src/pkg/manifests/install-beadm.mf
index 05f83de46b..9234f3f3f6 100644
--- a/usr/src/pkg/manifests/install-beadm.mf
+++ b/usr/src/pkg/manifests/install-beadm.mf
@@ -22,6 +22,7 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2010 Nexenta Systems, Inc. All rights reserved.
# Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
set name=pkg.fmri value=pkg:/install/beadm@$(PKGVERS)
@@ -34,10 +35,6 @@ dir path=usr group=sys
dir path=usr/include
dir path=usr/lib
dir path=usr/lib/$(ARCH64)
-dir path=usr/lib/python$(PYTHON_VERSION)
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/beadm
dir path=usr/sbin
dir path=usr/share
dir path=usr/share/man
@@ -49,11 +46,13 @@ file path=usr/lib/$(ARCH64)/llib-lbe.ln
file path=usr/lib/libbe.so.1
file path=usr/lib/llib-lbe
file path=usr/lib/llib-lbe.ln
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/64/libbe_py.so
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/libbe_py.so
file path=usr/share/man/man1m/beadm.1m
license cr_Sun license=cr_Sun
license lic_CDDL license=lic_CDDL
link path=usr/lib/$(ARCH64)/libbe.so target=./libbe.so.1
link path=usr/lib/libbe.so target=./libbe.so.1
link path=usr/sbin/beadm target=../../sbin/beadm
+$(python3_ONLY)depend fmri=system/library/python/libbe$(PYTHON3_PKGVERS) \
+ predicate=runtime/python$(PYTHON3_PKGVERS) type=conditional
+$(python2_ONLY)depend fmri=system/library/python/libbe$(PYTHON_PKGVERS) \
+ predicate=runtime/python$(PYTHON_PKGVERS) type=conditional
diff --git a/usr/src/pkg/manifests/system-file-system-zfs.mf b/usr/src/pkg/manifests/system-file-system-zfs.mf
index 7a2e44ed8b..69f9c71fcc 100644
--- a/usr/src/pkg/manifests/system-file-system-zfs.mf
+++ b/usr/src/pkg/manifests/system-file-system-zfs.mf
@@ -23,6 +23,7 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2017 by Delphix. All rights reserved.
# Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
set name=pkg.fmri value=pkg:/system/file-system/zfs@$(PKGVERS)
@@ -30,12 +31,6 @@ set name=pkg.description value="ZFS libraries and commands"
set name=pkg.summary value=ZFS
set name=info.classification \
value="org.opensolaris.category.2008:System/File System"
-
-#
-# Skip manifest generation until build 134 can be required on the
-# build systems, due to a Python flavor identification bug in pkgdepend.
-#
-set name=org.opensolaris.nodepend value=true
set name=variant.arch value=$(ARCH)
dir path=etc group=sys
dir path=etc/fs group=sys
@@ -66,9 +61,6 @@ dir path=usr/lib/mdb/kvm/$(ARCH64) group=sys
dir path=usr/lib/mdb/proc group=sys
$(sparc_ONLY)dir path=usr/lib/mdb/proc/$(ARCH64) group=sys
$(i386_ONLY)dir path=usr/lib/mdb/proc/$(ARCH64)
-dir path=usr/lib/python$(PYTHON_VERSION)
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs
dir path=usr/lib/sysevent
dir path=usr/lib/sysevent/modules
dir path=usr/lib/zfs
@@ -105,25 +97,6 @@ $(i386_ONLY)file path=usr/lib/libzpool.so.1
file path=usr/lib/mdb/kvm/$(ARCH64)/zfs.so group=sys mode=0555
file path=usr/lib/mdb/proc/$(ARCH64)/libzpool.so group=sys mode=0555
file path=usr/lib/mdb/proc/libzpool.so group=sys mode=0555
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/__init__.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/__init__.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/allow.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/allow.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/dataset.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/dataset.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/groupspace.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/groupspace.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/holds.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/holds.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/ioctl.so
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/table.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/table.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/unallow.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/unallow.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/userspace.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/userspace.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/util.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/util.pyc
file path=usr/lib/sysevent/modules/zfs_mod.so group=sys
file path=usr/lib/zfs/availdevs mode=0555
file path=usr/lib/zfs/pyzfs.py mode=0555
@@ -184,4 +157,7 @@ link path=usr/lib/llib-lzfs_core target=../../lib/llib-lzfs_core
link path=usr/lib/llib-lzfs_core.ln target=../../lib/llib-lzfs_core.ln
link path=usr/sbin/zfs target=../../sbin/zfs
link path=usr/sbin/zpool target=../../sbin/zpool
-depend fmri=runtime/python$(PYTHON_PKGVERS) type=require
+$(python3_ONLY)depend fmri=system/library/python/zfs$(PYTHON3_PKGVERS) \
+ predicate=runtime/python$(PYTHON3_PKGVERS) type=conditional
+$(python2_ONLY)depend fmri=system/library/python/zfs$(PYTHON_PKGVERS) \
+ predicate=runtime/python$(PYTHON_PKGVERS) type=conditional
diff --git a/usr/src/pkg/manifests/system-library-python-libbe-2.mf b/usr/src/pkg/manifests/system-library-python-libbe-2.mf
new file mode 100644
index 0000000000..c4d108c5f9
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-python-libbe-2.mf
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+set name=pkg.fmri \
+ value=pkg:/system/library/python/libbe$(PYTHON_PKGVERS)@$(PKGVERS)
+set name=pkg.description value="Boot Environment Management Python2 Module"
+set name=pkg.summary value="py_libbe module, python2"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/64/libbe_py.so
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/libbe_py.so
+license cr_Sun license=cr_Sun
+license lic_CDDL license=lic_CDDL
+$(python2_ONLY)depend fmri=runtime/python$(PYTHON_PKGVERS) type=require
diff --git a/usr/src/pkg/manifests/system-library-python-libbe-3.mf b/usr/src/pkg/manifests/system-library-python-libbe-3.mf
new file mode 100644
index 0000000000..43ab32586b
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-python-libbe-3.mf
@@ -0,0 +1,38 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+set name=pkg.fmri \
+ value=pkg:/system/library/python/libbe$(PYTHON3_PKGVERS)@$(PKGVERS)
+set name=pkg.description value="Boot Environment Management Python3 Module"
+set name=pkg.summary value="py_libbe module, python3"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/libbe_py.so
+license cr_Sun license=cr_Sun
+license lic_CDDL license=lic_CDDL
+$(python3_ONLY)depend fmri=runtime/python$(PYTHON3_PKGVERS) type=require
diff --git a/usr/src/pkg/manifests/system-library-python-solaris-2.mf b/usr/src/pkg/manifests/system-library-python-solaris-2.mf
new file mode 100644
index 0000000000..4b2bced94e
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-python-solaris-2.mf
@@ -0,0 +1,47 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+
+set name=pkg.fmri \
+ value=pkg:/system/library/python/solaris$(PYTHON_PKGVERS)@$(PKGVERS)
+set name=pkg.description value="Solaris Python2 Module"
+set name=pkg.summary value="solaris module, python2"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages
+$(python2_ONLY)dir \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris
+$(python2_ONLY)dir \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/64
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/64/misc.so
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/__init__.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/__init__.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/misc.so
+license cr_Sun license=cr_Sun
+license lic_CDDL license=lic_CDDL
+$(python2_ONLY)depend fmri=runtime/python$(PYTHON_PKGVERS) type=require
diff --git a/usr/src/pkg/manifests/system-library-python-solaris-3.mf b/usr/src/pkg/manifests/system-library-python-solaris-3.mf
new file mode 100644
index 0000000000..92c3c3a9dd
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-python-solaris-3.mf
@@ -0,0 +1,45 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+
+set name=pkg.fmri \
+ value=pkg:/system/library/python/solaris$(PYTHON3_PKGVERS)@$(PKGVERS)
+set name=pkg.description value="Solaris Python3 Module"
+set name=pkg.summary value="solaris module, python3"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages
+$(python3_ONLY)dir \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris
+$(python3_ONLY)dir \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris/__pycache__
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris/__init__.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris/__pycache__/__init__.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/solaris/misc.so
+license cr_Sun license=cr_Sun
+license lic_CDDL license=lic_CDDL
+$(python3_ONLY)depend fmri=runtime/python$(PYTHON3_PKGVERS) type=require
diff --git a/usr/src/pkg/manifests/system-library-python-zfs-2.mf b/usr/src/pkg/manifests/system-library-python-zfs-2.mf
new file mode 100644
index 0000000000..b95b383e76
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-python-zfs-2.mf
@@ -0,0 +1,79 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+set name=pkg.fmri \
+ value=pkg:/system/library/python/zfs$(PYTHON_PKGVERS)@$(PKGVERS)
+set name=pkg.description value="ZFS Python2 Module"
+set name=pkg.summary value="zfs module, python2"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs
+$(python2_ONLY)dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/64
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/64/ioctl.so
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/__init__.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/__init__.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/allow.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/allow.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/dataset.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/dataset.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/groupspace.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/groupspace.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/holds.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/holds.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/ioctl.so
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/table.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/table.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/unallow.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/unallow.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/userspace.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/userspace.pyc
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/util.py
+$(python2_ONLY)file \
+ path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/zfs/util.pyc
+license cr_Sun license=cr_Sun
+license lic_CDDL license=lic_CDDL
+$(python2_ONLY)depend fmri=runtime/python$(PYTHON_PKGVERS) type=require
diff --git a/usr/src/pkg/manifests/system-library-python-zfs-3.mf b/usr/src/pkg/manifests/system-library-python-zfs-3.mf
new file mode 100644
index 0000000000..86236f5127
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-python-zfs-3.mf
@@ -0,0 +1,78 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+set name=pkg.fmri \
+ value=pkg:/system/library/python/zfs$(PYTHON3_PKGVERS)@$(PKGVERS)
+set name=pkg.description value="ZFS Python3 Module"
+set name=pkg.summary value="zfs module, python3"
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/lib
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages
+$(python3_ONLY)dir path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs
+$(python3_ONLY)dir \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__init__.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/__init__.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/allow.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/dataset.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/groupspace.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/holds.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/table.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/unallow.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/userspace.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/__pycache__/util.cpython$(PYTHON3_PKGVERS).pyc
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/allow.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/dataset.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/groupspace.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/holds.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/ioctl.so
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/table.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/unallow.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/userspace.py
+$(python3_ONLY)file \
+ path=usr/lib/python$(PYTHON3_VERSION)/vendor-packages/zfs/util.py
+license cr_Sun license=cr_Sun
+license lic_CDDL license=lic_CDDL
+$(python3_ONLY)depend fmri=runtime/python$(PYTHON3_PKGVERS) type=require
diff --git a/usr/src/pkg/manifests/system-library.mf b/usr/src/pkg/manifests/system-library.mf
index 94ae932b59..941e64f74c 100644
--- a/usr/src/pkg/manifests/system-library.mf
+++ b/usr/src/pkg/manifests/system-library.mf
@@ -106,9 +106,6 @@ dir path=usr/lib/iconv/$(ARCH64)
$(i386_ONLY)dir path=usr/lib/libc
dir path=usr/lib/lwp
dir path=usr/lib/lwp/$(ARCH64)
-dir path=usr/lib/python$(PYTHON_VERSION)
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages
-dir path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris
dir path=usr/lib/raidcfg
dir path=usr/lib/raidcfg/$(ARCH64)
dir path=usr/lib/scsi
@@ -473,9 +470,6 @@ file path=usr/lib/libzoneinfo.so.1
file path=usr/lib/nss_ad.so.1
file path=usr/lib/nss_ldap.so.1
file path=usr/lib/passwdutil.so.1
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/__init__.py
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/__init__.pyc
-file path=usr/lib/python$(PYTHON_VERSION)/vendor-packages/solaris/misc.so
file path=usr/lib/raidcfg/$(ARCH64)/mpt.so.1
file path=usr/lib/raidcfg/mpt.so.1
file path=usr/lib/scsi/$(ARCH64)/libscsi.so.1
@@ -1327,6 +1321,10 @@ link path=usr/lib/straddr.so target=./straddr.so.2
link path=usr/xpg4/lib/$(ARCH64)/libcurses.so target=libcurses.so.2
link path=usr/xpg4/lib/64 target=$(ARCH64)
link path=usr/xpg4/lib/libcurses.so target=./libcurses.so.2
+$(python3_ONLY)depend fmri=system/library/python/solaris$(PYTHON3_PKGVERS) \
+ predicate=runtime/python$(PYTHON3_PKGVERS) type=conditional
+$(python2_ONLY)depend fmri=system/library/python/solaris$(PYTHON_PKGVERS) \
+ predicate=runtime/python$(PYTHON_PKGVERS) type=conditional
#
# libses.so needs to dlopen(3C) plugins from usr/lib/scsi/plugins/ses/vendor/,
# a dependency which cannot be automatically derived
diff --git a/usr/src/tools/env/illumos.sh b/usr/src/tools/env/illumos.sh
index 6994e3f8a4..bfff071b1d 100644
--- a/usr/src/tools/env/illumos.sh
+++ b/usr/src/tools/env/illumos.sh
@@ -22,6 +22,7 @@
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
# Configuration variables for the runtime environment of the nightly
@@ -245,7 +246,21 @@ export ENABLE_SMB_PRINTING=
# If your distro uses certain versions of Perl, make sure either Makefile.master
# contains your new defaults OR your .env file sets them.
-# These are how you would override for building on OmniOS r151012, for example.
-#export PERL_VERSION=5.16.1
+# These are how you would override for building on OmniOS r151028, for example.
+#export PERL_VERSION=5.28
#export PERL_ARCH=i86pc-solaris-thread-multi-64int
-#export PERL_PKGVERS=-5161
+#export PERL_PKGVERS=
+
+# If your distro uses certain versions of Python, make sure either
+# Makefile.master contains your new defaults OR your .env file sets them.
+#export PYTHON_VERSION=2.7
+#export PYTHON_PKGVERS=-27
+#export PYTHON_SUFFIX=
+#export PYTHON3_VERSION=3.5
+#export PYTHON3_PKGVERS=-35
+#export PYTHON3_SUFFIX=m
+
+# To disable building with either Python2 or Python 3 (or both), uncomment
+# these lines:
+#export BUILDPY2='#'
+#export BUILDPY3='#'