From 443c37331144d6c9323f65bb5b3a42abde5a9070 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 10:49:07 +0200 Subject: [PATCH 01/19] update CI matrix --- .github/workflows/tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 922de82a..9653147f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,14 @@ jobs: fail-fast: false matrix: os: [windows, ubuntu, macos] - python-version: ["3.8", "3.9", "3.10"] # "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + exclude: + - os: macos + python-version: "3.12" + - os: macos + python-version: "3.10" + - os: macos + python-version: "3.9" steps: - uses: actions/checkout@v3 From edc7d1b681a39f8e3da9511455ca6d91583f130e Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 10:54:04 +0200 Subject: [PATCH 02/19] install conda with --only-deps for now --- .github/workflows/tests.yml | 1 + tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9653147f..97b07cbd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,6 +65,7 @@ jobs: conda install -yq --solver libmamba \ --file tests/requirements.txt \ python=${{ matrix.python-version }} + conda install -yq --solver libmamba conda --only-deps - name: Patch conda with PR#11882 (TEMPORARY) shell: bash -el {0} diff --git a/tests/requirements.txt b/tests/requirements.txt index 5b82fa09..92a14bae 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,6 +1,6 @@ python pip -conda +# conda pydantic<2.0a0 pytest pytest-cov From 97a3f13055cb2ce5af2efd20cf8589102f8734db Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 13:52:00 +0200 Subject: [PATCH 03/19] state conda deps explicitly instead --- .github/workflows/tests.yml | 1 - tests/requirements.txt | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97b07cbd..9653147f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,7 +65,6 @@ jobs: conda install -yq --solver libmamba \ --file tests/requirements.txt \ python=${{ matrix.python-version }} - conda install -yq --solver libmamba conda --only-deps - name: Patch conda with PR#11882 (TEMPORARY) shell: bash -el {0} diff --git a/tests/requirements.txt b/tests/requirements.txt index 92a14bae..f115c5c7 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -6,3 +6,16 @@ pytest pytest-cov hypothesis hypothesis-jsonschema +# TMP - conda deps: +conda-package-handling>=2.2.0 +packaging>=23.0 +pycosat>=0.6.3 +pyopenssl>=16.2.0 +requests>=2.27.0,<3 +ruamel.yaml>=0.11.14,<0.18 +setuptools>=60.0.0 +pluggy>=1.0.0 +tqdm>=4 +boltons>=23.0.0 +jsonpatch>=1.32 +truststore>=0.8.0 From cf4c13f1d58210ac2be94e02dab34837d6c900f5 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 16:35:22 +0200 Subject: [PATCH 04/19] use PyObject + PyUnicode_AsWideCharString --- src/winshortcut.cpp | 64 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index 0be6e136..cf68ad7b 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -32,15 +32,15 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) { - Py_UNICODE *path; /* path and filename */ - Py_UNICODE *description; - Py_UNICODE *filename; + PyObject *py_path; /* path and filename */ + PyObject *py_description; + PyObject *py_filename; - Py_UNICODE *arguments = NULL; - Py_UNICODE *iconpath = NULL; + PyObject *py_arguments = NULL; + PyObject *py_iconpath = NULL; int iconindex = 0; - Py_UNICODE *workdir = NULL; - Py_UNICODE *app_id = NULL; + PyObject *py_workdir = NULL; + PyObject *py_app_id = NULL; IShellLink *pShellLink = NULL; IPersistFile *pPersistFile = NULL; @@ -56,9 +56,45 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) goto error; } - if (!PyArg_ParseTuple(args, "uuu|uuuiu", - &path, &description, &filename, - &arguments, &workdir, &iconpath, &iconindex, &app_id)) { + if (!PyArg_ParseTuple(args, "UUU|UUUiU", + &py_path, &py_description, &py_filename, + &py_arguments, &py_workdir, &py_iconpath, &iconindex, &py_app_id)) { + return NULL; + } + + wchar_t *path; + path = PyUnicode_AsWideCharString(py_path, NULL); + if (path == NULL) { + return NULL; + } + wchar_t *description; + description = PyUnicode_AsWideCharString(py_description, NULL); + if (description == NULL) { + return NULL; + } + wchar_t *filename; + filename = PyUnicode_AsWideCharString(py_filename, NULL); + if (filename == NULL) { + return NULL; + } + wchar_t *arguments; + arguments = PyUnicode_AsWideCharString(py_arguments, NULL); + if (arguments == NULL) { + return NULL; + } + wchar_t *workdir; + workdir = PyUnicode_AsWideCharString(py_workdir, NULL); + if (workdir == NULL) { + return NULL; + } + wchar_t *iconpath; + iconpath = PyUnicode_AsWideCharString(py_iconpath, NULL); + if (iconpath == NULL) { + return NULL; + } + wchar_t *app_id; + app_id = PyUnicode_AsWideCharString(py_app_id, NULL); + if (app_id == NULL) { return NULL; } @@ -159,6 +195,14 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) pPersistFile->Release(); pShellLink->Release(); + PyMem_Free(path); + PyMem_Free(description); + PyMem_Free(filename); + PyMem_Free(arguments); + PyMem_Free(workdir); + PyMem_Free(iconpath); + PyMem_Free(app_id); + CoUninitialize(); Py_RETURN_NONE; From ab20cc52579ac79426ad33c0dc537827bbb3ad15 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 16:47:37 +0200 Subject: [PATCH 05/19] use str() explicitly --- menuinst/_legacy/win32.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/menuinst/_legacy/win32.py b/menuinst/_legacy/win32.py index dffbce90..c2632914 100644 --- a/menuinst/_legacy/win32.py +++ b/menuinst/_legacy/win32.py @@ -316,10 +316,10 @@ def create(self, remove=False): # and 4 optional ones (args, working_dir, icon_path and # icon_index). create_shortcut( - u'' + cmd, - u'' + name + name_suffix, - u'' + dst, - u' '.join(arg for arg in args), - u'' + workdir, - u'' + icon, + str(cmd), + str(name + name_suffix), + str(dst), + ' '.join([str(arg) for arg in args]), + str(workdir), + str(icon), ) From b8e3aa454d601274615dde76bd5d589be394f25e Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 17:14:21 +0200 Subject: [PATCH 06/19] pass default values? --- menuinst/_legacy/win32.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/menuinst/_legacy/win32.py b/menuinst/_legacy/win32.py index c2632914..28b7b6cd 100644 --- a/menuinst/_legacy/win32.py +++ b/menuinst/_legacy/win32.py @@ -319,7 +319,9 @@ def create(self, remove=False): str(cmd), str(name + name_suffix), str(dst), - ' '.join([str(arg) for arg in args]), + " ".join([str(arg) for arg in args]), str(workdir), str(icon), + 0, + "", ) From 16e64e4c70bddc3e0c9e468f18bdf6b6b4d59a74 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 17:38:52 +0200 Subject: [PATCH 07/19] allow optional values again --- menuinst/_legacy/win32.py | 2 -- src/winshortcut.cpp | 62 +++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/menuinst/_legacy/win32.py b/menuinst/_legacy/win32.py index 28b7b6cd..f090f27e 100644 --- a/menuinst/_legacy/win32.py +++ b/menuinst/_legacy/win32.py @@ -322,6 +322,4 @@ def create(self, remove=False): " ".join([str(arg) for arg in args]), str(workdir), str(icon), - 0, - "", ) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index cf68ad7b..16f84cbb 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -33,8 +33,11 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) { PyObject *py_path; /* path and filename */ + wchar_t *path; PyObject *py_description; + wchar_t *description; PyObject *py_filename; + wchar_t *filename; PyObject *py_arguments = NULL; PyObject *py_iconpath = NULL; @@ -62,41 +65,18 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) return NULL; } - wchar_t *path; path = PyUnicode_AsWideCharString(py_path, NULL); if (path == NULL) { return NULL; } - wchar_t *description; description = PyUnicode_AsWideCharString(py_description, NULL); if (description == NULL) { return NULL; } - wchar_t *filename; filename = PyUnicode_AsWideCharString(py_filename, NULL); if (filename == NULL) { return NULL; } - wchar_t *arguments; - arguments = PyUnicode_AsWideCharString(py_arguments, NULL); - if (arguments == NULL) { - return NULL; - } - wchar_t *workdir; - workdir = PyUnicode_AsWideCharString(py_workdir, NULL); - if (workdir == NULL) { - return NULL; - } - wchar_t *iconpath; - iconpath = PyUnicode_AsWideCharString(py_iconpath, NULL); - if (iconpath == NULL) { - return NULL; - } - wchar_t *app_id; - app_id = PyUnicode_AsWideCharString(py_app_id, NULL); - if (app_id == NULL) { - return NULL; - } hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, @@ -130,34 +110,53 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) goto error; } - if (arguments) { + if (py_arguments) { + wchar_t *arguments = PyUnicode_AsWideCharString(py_arguments, NULL); + if (arguments == NULL) { + return NULL; + } hres = pShellLink->SetArguments(arguments); if (FAILED(hres)) { PyErr_Format(PyExc_OSError, "SetArguments() error 0x%x", hres); goto error; } + PyMem_Free(arguments); } - if (iconpath) { + if (py_iconpath) { + wchar_t *iconpath = PyUnicode_AsWideCharString(py_iconpath, NULL); + if (iconpath == NULL) { + return NULL; + } hres = pShellLink->SetIconLocation(iconpath, iconindex); if (FAILED(hres)) { PyErr_Format(PyExc_OSError, "SetIconLocation() error 0x%x", hres); goto error; } + PyMem_Free(iconpath); } - if (workdir) { + if (py_workdir) { + wchar_t *workdir = PyUnicode_AsWideCharString(py_workdir, NULL); + if (workdir == NULL) { + return NULL; + } hres = pShellLink->SetWorkingDirectory(workdir); if (FAILED(hres)) { PyErr_Format(PyExc_OSError, "SetWorkingDirectory() error 0x%x", hres); goto error; } + PyMem_Free(workdir); } - if (app_id) { + if (py_app_id) { + wchar_t *app_id = PyUnicode_AsWideCharString(py_app_id, NULL); + if (app_id == NULL) { + return NULL; + } hres = pShellLink->QueryInterface(IID_PPV_ARGS(&pPropertyStore)); if (FAILED(hres)) { PyErr_Format(PyExc_OSError, @@ -170,6 +169,7 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) "InitPropVariantFromString() error 0x%x", hres); goto error; } + PyMem_Free(app_id); pPropertyStore->SetValue(PKEY_AppUserModel_ID, pv); pPropertyStore->Commit(); PropVariantClear(&pv); @@ -198,10 +198,6 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(path); PyMem_Free(description); PyMem_Free(filename); - PyMem_Free(arguments); - PyMem_Free(workdir); - PyMem_Free(iconpath); - PyMem_Free(app_id); CoUninitialize(); Py_RETURN_NONE; @@ -217,6 +213,10 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) pPropertyStore->Release(); } + PyMem_Free(path); + PyMem_Free(description); + PyMem_Free(filename); + CoUninitialize(); return NULL; } From 2748a1c02f90b17ce7f7e690647c8d7227f792e7 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:05:14 +0200 Subject: [PATCH 08/19] better cleanup --- src/winshortcut.cpp | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index 16f84cbb..801e96a5 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -62,20 +62,20 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "UUU|UUUiU", &py_path, &py_description, &py_filename, &py_arguments, &py_workdir, &py_iconpath, &iconindex, &py_app_id)) { - return NULL; + goto error; } path = PyUnicode_AsWideCharString(py_path, NULL); if (path == NULL) { - return NULL; + goto error; } description = PyUnicode_AsWideCharString(py_description, NULL); if (description == NULL) { - return NULL; + goto error; } filename = PyUnicode_AsWideCharString(py_filename, NULL); if (filename == NULL) { - return NULL; + goto error; } hres = CoCreateInstance(CLSID_ShellLink, NULL, @@ -113,12 +113,13 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) if (py_arguments) { wchar_t *arguments = PyUnicode_AsWideCharString(py_arguments, NULL); if (arguments == NULL) { - return NULL; + goto error; } hres = pShellLink->SetArguments(arguments); if (FAILED(hres)) { PyErr_Format(PyExc_OSError, "SetArguments() error 0x%x", hres); + PyMem_Free(arguments); goto error; } PyMem_Free(arguments); @@ -127,12 +128,13 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) if (py_iconpath) { wchar_t *iconpath = PyUnicode_AsWideCharString(py_iconpath, NULL); if (iconpath == NULL) { - return NULL; + goto error; } hres = pShellLink->SetIconLocation(iconpath, iconindex); if (FAILED(hres)) { PyErr_Format(PyExc_OSError, "SetIconLocation() error 0x%x", hres); + PyMem_Free(iconpath); goto error; } PyMem_Free(iconpath); @@ -141,13 +143,14 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) if (py_workdir) { wchar_t *workdir = PyUnicode_AsWideCharString(py_workdir, NULL); if (workdir == NULL) { - return NULL; + goto error; } hres = pShellLink->SetWorkingDirectory(workdir); if (FAILED(hres)) { - PyErr_Format(PyExc_OSError, - "SetWorkingDirectory() error 0x%x", hres); - goto error; + PyErr_Format(PyExc_OSError, + "SetWorkingDirectory() error 0x%x", hres); + PyMem_Free(workdir); + goto error; } PyMem_Free(workdir); } @@ -155,7 +158,7 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) if (py_app_id) { wchar_t *app_id = PyUnicode_AsWideCharString(py_app_id, NULL); if (app_id == NULL) { - return NULL; + goto error; } hres = pShellLink->QueryInterface(IID_PPV_ARGS(&pPropertyStore)); if (FAILED(hres)) { @@ -199,6 +202,14 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(description); PyMem_Free(filename); + Py_XDECREF(py_path); + Py_XDECREF(py_description); + Py_XDECREF(py_filename); + Py_XDECREF(py_arguments); + Py_XDECREF(py_iconpath); + Py_XDECREF(py_workdir); + Py_XDECREF(py_app_id); + CoUninitialize(); Py_RETURN_NONE; @@ -216,6 +227,14 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(path); PyMem_Free(description); PyMem_Free(filename); + + Py_XDECREF(py_path); + Py_XDECREF(py_description); + Py_XDECREF(py_filename); + Py_XDECREF(py_arguments); + Py_XDECREF(py_iconpath); + Py_XDECREF(py_workdir); + Py_XDECREF(py_app_id); CoUninitialize(); return NULL; From f40edd8b860e8208d987f73df6a0859557b355a6 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:05:54 +0200 Subject: [PATCH 09/19] these cannot be NULL --- src/winshortcut.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index 801e96a5..5cc4a74e 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -202,9 +202,9 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(description); PyMem_Free(filename); - Py_XDECREF(py_path); - Py_XDECREF(py_description); - Py_XDECREF(py_filename); + Py_DECREF(py_path); + Py_DECREF(py_description); + Py_DECREF(py_filename); Py_XDECREF(py_arguments); Py_XDECREF(py_iconpath); Py_XDECREF(py_workdir); @@ -228,9 +228,9 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(description); PyMem_Free(filename); - Py_XDECREF(py_path); - Py_XDECREF(py_description); - Py_XDECREF(py_filename); + Py_DECREF(py_path); + Py_DECREF(py_description); + Py_DECREF(py_filename); Py_XDECREF(py_arguments); Py_XDECREF(py_iconpath); Py_XDECREF(py_workdir); From 8eb14d51c2f5d4002fde00126fea5679e3c6ad3d Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:09:46 +0200 Subject: [PATCH 10/19] amend docstring --- src/winshortcut.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index 5cc4a74e..dabf5a35 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -227,7 +227,7 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(path); PyMem_Free(description); PyMem_Free(filename); - + Py_DECREF(py_path); Py_DECREF(py_description); Py_DECREF(py_filename); @@ -244,7 +244,7 @@ PyMethodDef meth[] = { {"create_shortcut", CreateShortcut, METH_VARARGS, "winshortcut.create_shortcut(path, description, filename,\n" " arguments=u\"\", workdir=None, iconpath=None,\n" - " iconindex=0)\n" + " iconindex=0, app_id=None)\n" "\n" " Creates a shortcut ``filename`` (a .lnk file), whose\n" " target path is ``path``. All the input strings must be\n" From f69c2584940c588b31480adcad91fa8b4ead0157 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:17:30 +0200 Subject: [PATCH 11/19] guard these frees --- src/winshortcut.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index dabf5a35..4de7340a 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -33,11 +33,11 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) { PyObject *py_path; /* path and filename */ - wchar_t *path; + wchar_t *path = NULL; PyObject *py_description; - wchar_t *description; + wchar_t *description = NULL; PyObject *py_filename; - wchar_t *filename; + wchar_t *filename = NULL; PyObject *py_arguments = NULL; PyObject *py_iconpath = NULL; @@ -198,9 +198,15 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) pPersistFile->Release(); pShellLink->Release(); - PyMem_Free(path); - PyMem_Free(description); - PyMem_Free(filename); + if (path) { + PyMem_Free(path); + } + if (description) { + PyMem_Free(description); + } + if (filename) { + PyMem_Free(filename); + } Py_DECREF(py_path); Py_DECREF(py_description); From 996b8f015dbd7694d8c5b9ce146455fe9a876f65 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:20:08 +0200 Subject: [PATCH 12/19] more like this part --- src/winshortcut.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index 4de7340a..372dc5a5 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -198,15 +198,9 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) pPersistFile->Release(); pShellLink->Release(); - if (path) { - PyMem_Free(path); - } - if (description) { - PyMem_Free(description); - } - if (filename) { - PyMem_Free(filename); - } + PyMem_Free(path); + PyMem_Free(description); + PyMem_Free(filename); Py_DECREF(py_path); Py_DECREF(py_description); @@ -230,9 +224,15 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) pPropertyStore->Release(); } - PyMem_Free(path); - PyMem_Free(description); - PyMem_Free(filename); + if (path) { + PyMem_Free(path); + } + if (description) { + PyMem_Free(description); + } + if (filename) { + PyMem_Free(filename); + } Py_DECREF(py_path); Py_DECREF(py_description); From ebc9ca669df87eb8f4c648ca7af1211185f0bb4b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:26:02 +0200 Subject: [PATCH 13/19] add tmate --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9653147f..608aa245 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -87,6 +87,10 @@ jobs: name: Run test suite run: | python -I -m pytest tests/ --cov-append --cov-report=xml --cov=menuinst -vvv + + - uses: mxschmitt/action-tmate@v3 + timeout-minutes: 60 + if: failure() && matrix.os == 'windows' && matrix.python-version == '3.12' - uses: codecov/codecov-action@v1 with: From 0859c6643f01dc8ffdac9a5fcdf83b3a7fe2d5fb Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:58:55 +0200 Subject: [PATCH 14/19] remove Py_DECREF calls for now --- src/winshortcut.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/winshortcut.cpp b/src/winshortcut.cpp index 372dc5a5..c8700af0 100644 --- a/src/winshortcut.cpp +++ b/src/winshortcut.cpp @@ -202,14 +202,6 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(description); PyMem_Free(filename); - Py_DECREF(py_path); - Py_DECREF(py_description); - Py_DECREF(py_filename); - Py_XDECREF(py_arguments); - Py_XDECREF(py_iconpath); - Py_XDECREF(py_workdir); - Py_XDECREF(py_app_id); - CoUninitialize(); Py_RETURN_NONE; @@ -234,14 +226,6 @@ static PyObject *CreateShortcut(PyObject *self, PyObject *args) PyMem_Free(filename); } - Py_DECREF(py_path); - Py_DECREF(py_description); - Py_DECREF(py_filename); - Py_XDECREF(py_arguments); - Py_XDECREF(py_iconpath); - Py_XDECREF(py_workdir); - Py_XDECREF(py_app_id); - CoUninitialize(); return NULL; } From 684b591ad337e1dda60be6627061b2ca06ab687a Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 25 Oct 2023 18:59:30 +0200 Subject: [PATCH 15/19] remove tmate --- .github/workflows/tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 608aa245..9653147f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -87,10 +87,6 @@ jobs: name: Run test suite run: | python -I -m pytest tests/ --cov-append --cov-report=xml --cov=menuinst -vvv - - - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 - if: failure() && matrix.os == 'windows' && matrix.python-version == '3.12' - uses: codecov/codecov-action@v1 with: From 644c49a5f99c3fc67bbd1e55c09c733d25064a0a Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 16:05:26 +0100 Subject: [PATCH 16/19] update changelog with 1.4.20 details --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56f75179..46a28702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,9 @@ * @dbast made their first contribution in https://github.com/conda/menuinst/pull/116 * @aganders3 made their first contribution in https://github.com/conda/menuinst/pull/119 +## 1.4.20 (2023-10-30) + + * Add support for Python 3.12 (#165) ## 1.4.19 (2022-08-17) From c545aad84940732ede7b911a227b356b935ddb18 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 16:13:05 +0100 Subject: [PATCH 17/19] revert to regular conda dep --- .github/workflows/tests.yml | 2 +- tests/requirements.txt | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9653147f..8567d7bb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] exclude: - os: macos - python-version: "3.12" + python-version: "3.11" - os: macos python-version: "3.10" - os: macos diff --git a/tests/requirements.txt b/tests/requirements.txt index f115c5c7..5b82fa09 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,21 +1,8 @@ python pip -# conda +conda pydantic<2.0a0 pytest pytest-cov hypothesis hypothesis-jsonschema -# TMP - conda deps: -conda-package-handling>=2.2.0 -packaging>=23.0 -pycosat>=0.6.3 -pyopenssl>=16.2.0 -requests>=2.27.0,<3 -ruamel.yaml>=0.11.14,<0.18 -setuptools>=60.0.0 -pluggy>=1.0.0 -tqdm>=4 -boltons>=23.0.0 -jsonpatch>=1.32 -truststore>=0.8.0 From bd6aa4819d16bb6eaaa81225cc1ddddd8bb45321 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 16:13:11 +0100 Subject: [PATCH 18/19] revert win32 --- menuinst/_legacy/win32.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/menuinst/_legacy/win32.py b/menuinst/_legacy/win32.py index f090f27e..dffbce90 100644 --- a/menuinst/_legacy/win32.py +++ b/menuinst/_legacy/win32.py @@ -316,10 +316,10 @@ def create(self, remove=False): # and 4 optional ones (args, working_dir, icon_path and # icon_index). create_shortcut( - str(cmd), - str(name + name_suffix), - str(dst), - " ".join([str(arg) for arg in args]), - str(workdir), - str(icon), + u'' + cmd, + u'' + name + name_suffix, + u'' + dst, + u' '.join(arg for arg in args), + u'' + workdir, + u'' + icon, ) From cfafbf747cb63f3c7b221d6e592328bd625543fb Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 16:13:59 +0100 Subject: [PATCH 19/19] add news --- news/164-py312 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 news/164-py312 diff --git a/news/164-py312 b/news/164-py312 new file mode 100644 index 00000000..23b954c9 --- /dev/null +++ b/news/164-py312 @@ -0,0 +1,19 @@ +### Enhancements + +* Update `winshortcut` C extension to support Python 3.12. (#164) + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* + +### Other + +*