Skip to content

Commit

Permalink
revert file renaming of macos files; get them back to 'osx' prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jun 29, 2018
1 parent 05066d9 commit 1b09b5f
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 40 deletions.
14 changes: 7 additions & 7 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ include psutil/_exceptions.py
include psutil/_psaix.py
include psutil/_psbsd.py
include psutil/_pslinux.py
include psutil/_psmacos.py
include psutil/_psosx.py
include psutil/_psposix.py
include psutil/_pssunos.py
include psutil/_psutil_aix.c
include psutil/_psutil_bsd.c
include psutil/_psutil_common.c
include psutil/_psutil_common.h
include psutil/_psutil_linux.c
include psutil/_psutil_macos.c
include psutil/_psutil_osx.c
include psutil/_psutil_posix.c
include psutil/_psutil_posix.h
include psutil/_psutil_sunos.c
Expand All @@ -55,16 +55,16 @@ include psutil/arch/freebsd/specific.c
include psutil/arch/freebsd/specific.h
include psutil/arch/freebsd/sys_socks.c
include psutil/arch/freebsd/sys_socks.h
include psutil/arch/macos/process_info.c
include psutil/arch/macos/process_info.h
include psutil/arch/macos/smc.c
include psutil/arch/macos/smc.h
include psutil/arch/netbsd/socks.c
include psutil/arch/netbsd/socks.h
include psutil/arch/netbsd/specific.c
include psutil/arch/netbsd/specific.h
include psutil/arch/openbsd/specific.c
include psutil/arch/openbsd/specific.h
include psutil/arch/osx/process_info.c
include psutil/arch/osx/process_info.h
include psutil/arch/osx/smc.c
include psutil/arch/osx/smc.h
include psutil/arch/solaris/environ.c
include psutil/arch/solaris/environ.h
include psutil/arch/solaris/v10/ifaddrs.c
Expand All @@ -88,7 +88,7 @@ include psutil/tests/test_bsd.py
include psutil/tests/test_connections.py
include psutil/tests/test_contracts.py
include psutil/tests/test_linux.py
include psutil/tests/test_macos.py
include psutil/tests/test_osx.py
include psutil/tests/test_memory_leaks.py
include psutil/tests/test_misc.py
include psutil/tests/test_posix.py
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ test-posix: ## POSIX specific tests.

test-platform: ## Run specific platform tests only.
${MAKE} install
$(TEST_PREFIX) $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "MACOS", "SUNOS", "WINDOWS", "AIX") if getattr(psutil, x)][0])'`.py
$(TEST_PREFIX) $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS", "AIX") if getattr(psutil, x)][0])'`.py

test-memleaks: ## Memory leak tests.
${MAKE} install
Expand Down
2 changes: 1 addition & 1 deletion psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
from ._pswindows import CONN_DELETE_TCB # NOQA

elif MACOS:
from . import _psmacos as _psplatform
from . import _psosx as _psplatform

elif BSD:
from . import _psbsd as _psplatform
Expand Down
2 changes: 1 addition & 1 deletion psutil/_psmacos.py → psutil/_psosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from . import _common
from . import _psposix
from . import _psutil_macos as cext
from . import _psutil_osx as cext
from . import _psutil_posix as cext_posix
from ._common import AF_INET6
from ._common import conn_tmap
Expand Down
26 changes: 13 additions & 13 deletions psutil/_psutil_macos.c → psutil/_psutil_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@

#include "_psutil_common.h"
#include "_psutil_posix.h"
#include "arch/macos/process_info.h"
#include "arch/macos/smc.h"
#include "arch/osx/process_info.h"
#include "arch/osx/smc.h"


#define PSUTIL_TV2DOUBLE(t) ((t).tv_sec + (t).tv_usec / 1000000.0)
Expand Down Expand Up @@ -342,7 +342,7 @@ psutil_proc_cmdline(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;

// get the commandline, defined in arch/macos/process_info.c
// get the commandline, defined in arch/osx/process_info.c
py_retlist = psutil_get_cmdline(pid);
return py_retlist;
}
Expand All @@ -359,7 +359,7 @@ psutil_proc_environ(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;

// get the environment block, defined in arch/macos/process_info.c
// get the environment block, defined in arch/osx/process_info.c
py_retdict = psutil_get_environ(pid);
return py_retdict;
}
Expand Down Expand Up @@ -2066,45 +2066,45 @@ struct module_state {
#if PY_MAJOR_VERSION >= 3

static int
psutil_macos_traverse(PyObject *m, visitproc visit, void *arg) {
psutil_osx_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(GETSTATE(m)->error);
return 0;
}

static int
psutil_macos_clear(PyObject *m) {
psutil_osx_clear(PyObject *m) {
Py_CLEAR(GETSTATE(m)->error);
return 0;
}


static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"psutil_macos",
"psutil_osx",
NULL,
sizeof(struct module_state),
PsutilMethods,
NULL,
psutil_macos_traverse,
psutil_macos_clear,
psutil_osx_traverse,
psutil_osx_clear,
NULL
};

#define INITERROR return NULL

PyMODINIT_FUNC PyInit__psutil_macos(void)
PyMODINIT_FUNC PyInit__psutil_osx(void)

#else
#define INITERROR return

void
init_psutil_macos(void)
init_psutil_osx(void)
#endif
{
#if PY_MAJOR_VERSION >= 3
PyObject *module = PyModule_Create(&moduledef);
#else
PyObject *module = Py_InitModule("_psutil_macos", PsutilMethods);
PyObject *module = Py_InitModule("_psutil_osx", PsutilMethods);
#endif
PyModule_AddIntConstant(module, "version", PSUTIL_VERSION);
// process status constants, defined in:
Expand All @@ -2130,7 +2130,7 @@ init_psutil_macos(void)

// Exception.
ZombieProcessError = PyErr_NewException(
"_psutil_macos.ZombieProcessError", NULL, NULL);
"_psutil_osx.ZombieProcessError", NULL, NULL);
Py_INCREF(ZombieProcessError);
PyModule_AddObject(module, "ZombieProcessError", ZombieProcessError);

Expand Down
16 changes: 8 additions & 8 deletions psutil/_psutil_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <netdb.h>
#include <linux/types.h>
#include <linux/if_packet.h>
#elif defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
#elif defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
#include <netdb.h>
#include <netinet/in.h>
#include <net/if_dl.h>
Expand Down Expand Up @@ -71,7 +71,7 @@ psutil_pid_exists(long pid) {
#endif
}

#if defined(PSUTIL_MACOS)
#if defined(PSUTIL_OSX)
ret = kill((pid_t)pid , 0);
#else
ret = kill(pid , 0);
Expand Down Expand Up @@ -143,7 +143,7 @@ psutil_posix_getpriority(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;

#ifdef PSUTIL_MACOS
#ifdef PSUTIL_OSX
priority = getpriority(PRIO_PROCESS, (id_t)pid);
#else
priority = getpriority(PRIO_PROCESS, pid);
Expand All @@ -166,7 +166,7 @@ psutil_posix_setpriority(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "li", &pid, &priority))
return NULL;

#ifdef PSUTIL_MACOS
#ifdef PSUTIL_OSX
retval = setpriority(PRIO_PROCESS, (id_t)pid, priority);
#else
retval = setpriority(PRIO_PROCESS, pid, priority);
Expand Down Expand Up @@ -221,7 +221,7 @@ psutil_convert_ipaddr(struct sockaddr *addr, int family) {
len = lladdr->sll_halen;
data = (const char *)lladdr->sll_addr;
}
#elif defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
#elif defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
else if (addr->sa_family == AF_LINK) {
// Note: prior to Python 3.4 socket module does not expose
// AF_LINK so we'll do.
Expand Down Expand Up @@ -433,7 +433,7 @@ psutil_net_if_flags(PyObject *self, PyObject *args) {
/*
* net_if_stats() macOS/BSD implementation.
*/
#if defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX)

int psutil_get_nic_speed(int ifm_active) {
// Determine NIC speed. Taken from:
Expand Down Expand Up @@ -638,7 +638,7 @@ PsutilMethods[] = {
"Retrieve NIC MTU"},
{"net_if_flags", psutil_net_if_flags, METH_VARARGS,
"Retrieve NIC flags"},
#if defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
{"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS,
"Return NIC stats."},
#endif
Expand Down Expand Up @@ -698,7 +698,7 @@ void init_psutil_posix(void)
PyObject *module = Py_InitModule("_psutil_posix", PsutilMethods);
#endif

#if defined(PSUTIL_BSD) || defined(PSUTIL_MACOS) || defined(PSUTIL_SUNOS) || defined(PSUTIL_AIX)
#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX) || defined(PSUTIL_SUNOS) || defined(PSUTIL_AIX)
PyModule_AddIntConstant(module, "AF_LINK", AF_LINK);
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* found in the LICENSE file.
*
* Helper functions related to fetching process information.
* Used by _psutil_macos module methods.
* Used by _psutil_osx module methods.
*/


Expand Down Expand Up @@ -142,7 +142,7 @@ psutil_get_cmdline(long pid) {
mib[2] = (pid_t)pid;
if (sysctl(mib, 3, procargs, &argmax, NULL, 0) < 0) {
// In case of zombie process we'll get EINVAL. We translate it
// to NSP and _psmacos.py will translate it to ZP.
// to NSP and _psosx.py will translate it to ZP.
if ((errno == EINVAL) && (psutil_pid_exists(pid)))
NoSuchProcess("");
else
Expand Down Expand Up @@ -236,7 +236,7 @@ psutil_get_environ(long pid) {
mib[2] = (pid_t)pid;
if (sysctl(mib, 3, procargs, &argmax, NULL, 0) < 0) {
// In case of zombie process we'll get EINVAL. We translate it
// to NSP and _psmacos.py will translate it to ZP.
// to NSP and _psosx.py will translate it to ZP.
if ((errno == EINVAL) && (psutil_pid_exists(pid)))
NoSuchProcess("");
else
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ def get_suite():
x.startswith('test_memory_leaks')]
if "WHEELHOUSE_UPLOADER_USERNAME" in os.environ:
testmods = [x for x in testmods if not x.endswith((
"macos", "posix", "linux"))]
"osx", "posix", "linux"))]
suite = unittest.TestSuite()
for tm in testmods:
# ...so that the full test paths are printed on screen
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ def get_winver():
)

elif MACOS:
macros.append(("PSUTIL_MACOS", 1))
macros.append(("PSUTIL_OSX", 1))
ext = Extension(
'psutil._psutil_macos',
'psutil._psutil_osx',
sources=sources + [
'psutil/_psutil_macos.c',
'psutil/arch/macos/process_info.c',
'psutil/arch/macos/smc.c',
'psutil/_psutil_osx.c',
'psutil/arch/osx/process_info.c',
'psutil/arch/osx/smc.c',
],
define_macros=macros,
extra_link_args=[
Expand Down

0 comments on commit 1b09b5f

Please sign in to comment.