From 6cee566662caf9451c41ae8e7a4af4c6471a829d Mon Sep 17 00:00:00 2001 From: pxin Date: Thu, 14 Mar 2019 15:20:21 +0800 Subject: [PATCH 1/4] adapt _crypt module to VxWorks --- Modules/_cryptmodule.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c index 5d03f45f643615..a7aba7abd316d8 100644 --- a/Modules/_cryptmodule.c +++ b/Modules/_cryptmodule.c @@ -4,7 +4,9 @@ #include "Python.h" #include - +#ifdef __VXWORKS__ +#include +#endif /* Module crypt */ /*[clinic input] @@ -39,8 +41,12 @@ crypt_crypt_impl(PyObject *module, const char *word, const char *salt) struct crypt_data data; memset(&data, 0, sizeof(data)); crypt_result = crypt_r(word, salt, &data); +#else +#ifdef __VXWORKS__ + crypt_result = DES_crypt(word, salt); #else crypt_result = crypt(word, salt); +#endif #endif return Py_BuildValue("s", crypt_result); } From 416d1ac2fc53409c91444b9dc0b1f837e6bce18f Mon Sep 17 00:00:00 2001 From: pxin Date: Thu, 14 Mar 2019 15:21:48 +0800 Subject: [PATCH 2/4] add news file --- .../NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst diff --git a/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst b/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst new file mode 100644 index 00000000000000..ee2a93c9c9e6ad --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst @@ -0,0 +1 @@ +Adapt _crypt module to VxWorks. From 2adde844ae605883a77d2358687592cfd50577fa Mon Sep 17 00:00:00 2001 From: pxin Date: Fri, 15 Mar 2019 13:07:26 +0800 Subject: [PATCH 3/4] Macro crypt to DES_crypt on VxWorks --- Modules/_cryptmodule.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c index a7aba7abd316d8..6517dc8521cd6e 100644 --- a/Modules/_cryptmodule.c +++ b/Modules/_cryptmodule.c @@ -6,6 +6,7 @@ #include #ifdef __VXWORKS__ #include +#define crypt DES_crypt #endif /* Module crypt */ @@ -41,12 +42,8 @@ crypt_crypt_impl(PyObject *module, const char *word, const char *salt) struct crypt_data data; memset(&data, 0, sizeof(data)); crypt_result = crypt_r(word, salt, &data); -#else -#ifdef __VXWORKS__ - crypt_result = DES_crypt(word, salt); #else crypt_result = crypt(word, salt); -#endif #endif return Py_BuildValue("s", crypt_result); } From e41a5eedd05f4989d6df171513377d39c3060aa3 Mon Sep 17 00:00:00 2001 From: pxin Date: Mon, 1 Apr 2019 16:26:15 +0800 Subject: [PATCH 4/4] remove crypt module support for VxWorks --- Doc/library/crypt.rst | 2 ++ .../Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst | 2 +- Modules/_cryptmodule.c | 5 +---- setup.py | 10 +++------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst index 43d4b5b749e4ed..fe199aaa5ead10 100644 --- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -30,6 +30,8 @@ the :manpage:`crypt(3)` routine in the running system. Therefore, any extensions available on the current implementation will also be available on this module. +Note: VxWorks doesn't support this module. + Hashing Methods --------------- diff --git a/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst b/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst index ee2a93c9c9e6ad..a7a6fbd88834a9 100644 --- a/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst +++ b/Misc/NEWS.d/next/Library/2019-03-14-15-21-01.bpo-31904.38fdkg.rst @@ -1 +1 @@ -Adapt _crypt module to VxWorks. +Remove crypt module support for VxWorks. diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c index 6517dc8521cd6e..5d03f45f643615 100644 --- a/Modules/_cryptmodule.c +++ b/Modules/_cryptmodule.c @@ -4,10 +4,7 @@ #include "Python.h" #include -#ifdef __VXWORKS__ -#include -#define crypt DES_crypt -#endif + /* Module crypt */ /*[clinic input] diff --git a/setup.py b/setup.py index b96961073b987b..1fd42699189cdb 100644 --- a/setup.py +++ b/setup.py @@ -980,12 +980,7 @@ def detect_crypt(self): else: libs = [] - if not VXWORKS: - self.add(Extension('_crypt', ['_cryptmodule.c'], - libraries=libs)) - elif self.compiler.find_library_file(self.lib_dirs, 'OPENSSL'): - libs = ['OPENSSL'] - self.add(Extension('_crypt', ['_cryptmodule.c'], + self.add(Extension('_crypt', ['_cryptmodule.c'], libraries=libs)) def detect_socket(self): @@ -1641,7 +1636,8 @@ def detect_modules(self): if TEST_EXTENSIONS: self.detect_test_extensions() self.detect_readline_curses() - self.detect_crypt() + if not VXWORKS: + self.detect_crypt() self.detect_socket() self.detect_openssl_hashlib() self.detect_dbm_gdbm()