diff --git a/.github/workflows/pybuilder.yml b/.github/workflows/pybuilder.yml index 2b522f346..c26e38bb5 100644 --- a/.github/workflows/pybuilder.yml +++ b/.github/workflows/pybuilder.yml @@ -14,7 +14,7 @@ jobs: os: - ubuntu-latest python-version: - - '3.11.0-beta.3' + - '3.11.0-beta.5' - '3.10' - '3.9' - '3.8' @@ -47,7 +47,7 @@ jobs: - windows-latest - macos-11 python-version: - - '3.11.0-beta.3' + - '3.11.0-beta.5' - '3.10' - '3.9' - '3.8' diff --git a/src/main/python/pybuilder/_vendor/LICENSES b/src/main/python/pybuilder/_vendor/LICENSES index 4dfce67eb..8e51dd1fa 100644 --- a/src/main/python/pybuilder/_vendor/LICENSES +++ b/src/main/python/pybuilder/_vendor/LICENSES @@ -1,4 +1,210 @@ -virtualenv-20.14.1 +importlib_metadata-4.12.0 +========== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +virtualenv-20.16.2 ========== Copyright (c) 2020-202x The virtualenv developers @@ -22,41 +228,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -importlib_metadata-4.11.4 -========== -Copyright 2017-2019 Jason R. Coombs, Barry Warsaw - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -importlib_resources-5.7.1 -========== -Copyright 2017-2019 Brett Cannon, Barry Warsaw - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -colorama-0.4.4 +colorama-0.4.5 ========== Copyright (c) 2010 Jonathan Hartley All rights reserved. @@ -87,7 +259,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -filelock-3.7.0 +filelock-3.7.1 ========== This is free and unencumbered software released into the public domain. @@ -115,7 +287,213 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to -setuptools-62.3.2 +importlib_resources-5.9.0 +========== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +setuptools-63.2.0 ========== Copyright Jason R. Coombs @@ -138,28 +516,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -six-1.16.0 -========== -Copyright (c) 2010-2020 Benjamin Peterson - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - tblib-1.7.0 ========== BSD 2-Clause License @@ -184,7 +540,30 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -typing_extensions-4.2.0 +zipp-3.8.1 +========== +Copyright Jason R. Coombs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + + +distlib-0.3.5 ========== A. HISTORY OF THE SOFTWARE ========================== @@ -224,9 +603,39 @@ the various releases. 2.1 2.0+1.6.1 2001 PSF no 2.0.1 2.0+1.6.1 2001 PSF yes 2.1.1 2.1+2.0.1 2001 PSF yes + 2.2 2.1.1 2001 PSF yes 2.1.2 2.1.1 2002 PSF yes 2.1.3 2.1.2 2002 PSF yes - 2.2 and above 2.1.1 2001-now PSF yes + 2.2.1 2.2 2002 PSF yes + 2.2.2 2.2.1 2002 PSF yes + 2.2.3 2.2.2 2003 PSF yes + 2.3 2.2.2 2002-2003 PSF yes + 2.3.1 2.3 2002-2003 PSF yes + 2.3.2 2.3.1 2002-2003 PSF yes + 2.3.3 2.3.2 2002-2003 PSF yes + 2.3.4 2.3.3 2004 PSF yes + 2.3.5 2.3.4 2005 PSF yes + 2.4 2.3 2004 PSF yes + 2.4.1 2.4 2005 PSF yes + 2.4.2 2.4.1 2005 PSF yes + 2.4.3 2.4.2 2006 PSF yes + 2.4.4 2.4.3 2006 PSF yes + 2.5 2.4 2006 PSF yes + 2.5.1 2.5 2007 PSF yes + 2.5.2 2.5.1 2008 PSF yes + 2.5.3 2.5.2 2008 PSF yes + 2.6 2.5 2008 PSF yes + 2.6.1 2.6 2008 PSF yes + 2.6.2 2.6.1 2009 PSF yes + 2.6.3 2.6.2 2009 PSF yes + 2.6.4 2.6.3 2009 PSF yes + 2.6.5 2.6.4 2010 PSF yes + 3.0 2.6 2008 PSF yes + 3.0.1 3.0 2009 PSF yes + 3.1 3.0.1 2009 PSF yes + 3.1.1 3.1 2009 PSF yes + 3.1.2 3.1 2010 PSF yes + 3.2 3.1 2010 PSF yes Footnotes: @@ -261,9 +670,9 @@ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014 Python Software Foundation; All Rights Reserved" are -retained in Python alone or in any derivative version prepared by Licensee. +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +Python Software Foundation; All Rights Reserved" are retained in Python alone or +in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make @@ -442,30 +851,28 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -zipp-3.8.0 +tailer-0.4.1 ========== -Copyright Jason R. Coombs +Copyright (c) 2012 Mike Thornton Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. - +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -distlib-0.3.4 +typing_extensions-4.3.0 ========== A. HISTORY OF THE SOFTWARE ========================== @@ -505,39 +912,9 @@ the various releases. 2.1 2.0+1.6.1 2001 PSF no 2.0.1 2.0+1.6.1 2001 PSF yes 2.1.1 2.1+2.0.1 2001 PSF yes - 2.2 2.1.1 2001 PSF yes 2.1.2 2.1.1 2002 PSF yes 2.1.3 2.1.2 2002 PSF yes - 2.2.1 2.2 2002 PSF yes - 2.2.2 2.2.1 2002 PSF yes - 2.2.3 2.2.2 2003 PSF yes - 2.3 2.2.2 2002-2003 PSF yes - 2.3.1 2.3 2002-2003 PSF yes - 2.3.2 2.3.1 2002-2003 PSF yes - 2.3.3 2.3.2 2002-2003 PSF yes - 2.3.4 2.3.3 2004 PSF yes - 2.3.5 2.3.4 2005 PSF yes - 2.4 2.3 2004 PSF yes - 2.4.1 2.4 2005 PSF yes - 2.4.2 2.4.1 2005 PSF yes - 2.4.3 2.4.2 2006 PSF yes - 2.4.4 2.4.3 2006 PSF yes - 2.5 2.4 2006 PSF yes - 2.5.1 2.5 2007 PSF yes - 2.5.2 2.5.1 2008 PSF yes - 2.5.3 2.5.2 2008 PSF yes - 2.6 2.5 2008 PSF yes - 2.6.1 2.6 2008 PSF yes - 2.6.2 2.6.1 2009 PSF yes - 2.6.3 2.6.2 2009 PSF yes - 2.6.4 2.6.3 2009 PSF yes - 2.6.5 2.6.4 2010 PSF yes - 3.0 2.6 2008 PSF yes - 3.0.1 3.0 2009 PSF yes - 3.1 3.0.1 2009 PSF yes - 3.1.1 3.1 2009 PSF yes - 3.1.2 3.1 2010 PSF yes - 3.2 3.1 2010 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes Footnotes: @@ -572,9 +949,9 @@ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -Python Software Foundation; All Rights Reserved" are retained in Python alone or -in any derivative version prepared by Licensee. +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012, 2013, 2014 Python Software Foundation; All Rights Reserved" are +retained in Python alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make @@ -753,24 +1130,3 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -tailer-0.4.1 -========== -Copyright (c) 2012 Mike Thornton - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/src/main/python/pybuilder/_vendor/__init__.py b/src/main/python/pybuilder/_vendor/__init__.py index 5b7679faa..0df6cac63 100644 --- a/src/main/python/pybuilder/_vendor/__init__.py +++ b/src/main/python/pybuilder/_vendor/__init__.py @@ -1 +1 @@ -__names__ = ['_distutils_hack', 'colorama', 'distlib', 'filelock', 'importlib_metadata', 'importlib_resources', 'pkg_resources', 'platformdirs', 'six', 'tailer', 'tblib', 'typing_extensions', 'virtualenv', 'zipp'] +__names__ = ['_distutils_hack', 'colorama', 'distlib', 'filelock', 'importlib_metadata', 'importlib_resources', 'pkg_resources', 'platformdirs', 'tailer', 'tblib', 'typing_extensions', 'virtualenv', 'zipp'] diff --git a/src/main/python/pybuilder/_vendor/_distutils_hack/__init__.py b/src/main/python/pybuilder/_vendor/_distutils_hack/__init__.py index 605a6edc7..f987a5367 100644 --- a/src/main/python/pybuilder/_vendor/_distutils_hack/__init__.py +++ b/src/main/python/pybuilder/_vendor/_distutils_hack/__init__.py @@ -14,22 +14,26 @@ def warn_distutils_present(): # https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250 return import warnings + warnings.warn( "Distutils was imported before Setuptools, but importing Setuptools " "also replaces the `distutils` module in `sys.modules`. This may lead " "to undesirable behaviors or errors. To avoid these issues, avoid " "using distutils directly, ensure that setuptools is installed in the " "traditional way (e.g. not an editable install), and/or make sure " - "that setuptools is always imported before distutils.") + "that setuptools is always imported before distutils." + ) def clear_distutils(): if 'distutils' not in sys.modules: return import warnings + warnings.warn("Setuptools is replacing distutils.") mods = [ - name for name in sys.modules + name + for name in sys.modules if name == "distutils" or name.startswith("distutils.") ] for name in mods: @@ -46,6 +50,7 @@ def enabled(): def ensure_local_distutils(): import importlib + clear_distutils() # With the DistutilsMetaFinder in place, @@ -82,7 +87,9 @@ def match(self, string): class DistutilsMetaFinder: def find_spec(self, fullname, path, target=None): - if path is not None: + # optimization: only consider top level modules and those + # found in the CPython test suite. + if path is not None and not fullname.startswith('test.'): return method_name = 'spec_for_{fullname}'.format(**locals()) @@ -111,7 +118,6 @@ def spec_for_distutils(self): return class DistutilsLoader(importlib.abc.Loader): - def create_module(self, spec): mod.__name__ = 'distutils' return mod @@ -147,9 +153,9 @@ def pip_imported_during_build(cls): Detect if pip is being imported in a build script. Ref #2355. """ import traceback + return any( - cls.frame_file_is_setup(frame) - for frame, line in traceback.walk_stack(None) + cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None) ) @staticmethod @@ -160,6 +166,35 @@ def frame_file_is_setup(frame): # some frames may not have __file__ (#2940) return frame.f_globals.get('__file__', '').endswith('setup.py') + def spec_for_sensitive_tests(self): + """ + Ensure stdlib distutils when running select tests under CPython. + + python/cpython#91169 + """ + clear_distutils() + self.spec_for_distutils = lambda: None + + sensitive_tests = ( + [ + 'test.test_distutils', + 'test.test_peg_generator', + 'test.test_importlib', + ] + if sys.version_info < (3, 10) + else [ + 'test.test_distutils', + ] + ) + + +for name in DistutilsMetaFinder.sensitive_tests: + setattr( + DistutilsMetaFinder, + f'spec_for_{name}', + DistutilsMetaFinder.spec_for_sensitive_tests, + ) + DISTUTILS_FINDER = DistutilsMetaFinder() diff --git a/src/main/python/pybuilder/_vendor/colorama/__init__.py b/src/main/python/pybuilder/_vendor/colorama/__init__.py index b149ed79b..9138a8cc8 100644 --- a/src/main/python/pybuilder/_vendor/colorama/__init__.py +++ b/src/main/python/pybuilder/_vendor/colorama/__init__.py @@ -3,4 +3,4 @@ from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 -__version__ = '0.4.4' +__version__ = '0.4.5' diff --git a/src/main/python/pybuilder/_vendor/colorama/ansitowin32.py b/src/main/python/pybuilder/_vendor/colorama/ansitowin32.py index 6039a0543..3db248baa 100644 --- a/src/main/python/pybuilder/_vendor/colorama/ansitowin32.py +++ b/src/main/python/pybuilder/_vendor/colorama/ansitowin32.py @@ -37,6 +37,12 @@ def __enter__(self, *args, **kwargs): def __exit__(self, *args, **kwargs): return self.__wrapped.__exit__(*args, **kwargs) + def __setstate__(self, state): + self.__dict__ = state + + def __getstate__(self): + return self.__dict__ + def write(self, text): self.__convertor.write(text) @@ -57,7 +63,9 @@ def closed(self): stream = self.__wrapped try: return stream.closed - except AttributeError: + # AttributeError in the case that the stream doesn't support being closed + # ValueError for the case that the stream has already been detached when atexit runs + except (AttributeError, ValueError): return True diff --git a/src/main/python/pybuilder/_vendor/distlib/__init__.py b/src/main/python/pybuilder/_vendor/distlib/__init__.py index 6878387a0..505556517 100644 --- a/src/main/python/pybuilder/_vendor/distlib/__init__.py +++ b/src/main/python/pybuilder/_vendor/distlib/__init__.py @@ -6,7 +6,7 @@ # import logging -__version__ = '0.3.4' +__version__ = '0.3.5' class DistlibException(Exception): pass diff --git a/src/main/python/pybuilder/_vendor/distlib/database.py b/src/main/python/pybuilder/_vendor/distlib/database.py index f48699441..5db5d7f50 100644 --- a/src/main/python/pybuilder/_vendor/distlib/database.py +++ b/src/main/python/pybuilder/_vendor/distlib/database.py @@ -385,8 +385,9 @@ def provides(self): def _get_requirements(self, req_attr): md = self.metadata - logger.debug('Getting requirements from metadata %r', md.todict()) reqts = getattr(md, req_attr) + logger.debug('%s: got requirements %r from metadata: %r', self.name, req_attr, + reqts) return set(md.get_requirements(reqts, extras=self.extras, env=self.context)) @@ -1314,22 +1315,26 @@ def get_required_dists(dists, dist): :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested + in finding the dependencies. """ if dist not in dists: raise DistlibException('given distribution %r is not a member ' 'of the list' % dist.name) graph = make_graph(dists) - req = [] # required distributions + req = set() # required distributions todo = graph.adjacency_list[dist] # list of nodes we should inspect + seen = set(t[0] for t in todo) # already added to todo while todo: d = todo.pop()[0] - req.append(d) - for pred in graph.adjacency_list[d]: - if pred not in req: + req.add(d) + pred_list = graph.adjacency_list[d] + for pred in pred_list: + d = pred[0] + if d not in req and d not in seen: + seen.add(d) todo.append(pred) - return req diff --git a/src/main/python/pybuilder/_vendor/distlib/index.py b/src/main/python/pybuilder/_vendor/distlib/index.py index b1fbbf8e8..9b6d129ed 100644 --- a/src/main/python/pybuilder/_vendor/distlib/index.py +++ b/src/main/python/pybuilder/_vendor/distlib/index.py @@ -12,7 +12,7 @@ import tempfile try: from threading import Thread -except ImportError: +except ImportError: # pragma: no cover from dummy_threading import Thread from . import DistlibException @@ -104,7 +104,7 @@ def check_credentials(self): pm.add_password(self.realm, netloc, self.username, self.password) self.password_handler = HTTPBasicAuthHandler(pm) - def register(self, metadata): + def register(self, metadata): # pragma: no cover """ Register a distribution on PyPI, using the provided metadata. @@ -142,8 +142,7 @@ def _reader(self, name, stream, outbuf): logger.debug('%s: %s' % (name, s)) stream.close() - def get_sign_command(self, filename, signer, sign_password, - keystore=None): + def get_sign_command(self, filename, signer, sign_password, keystore=None): # pragma: no cover """ Return a suitable command for signing a file. @@ -206,7 +205,7 @@ def run_command(self, cmd, input_data=None): t2.join() return p.returncode, stdout, stderr - def sign_file(self, filename, signer, sign_password, keystore=None): + def sign_file(self, filename, signer, sign_password, keystore=None): # pragma: no cover """ Sign a file. @@ -286,7 +285,7 @@ def upload_file(self, metadata, filename, signer=None, sign_password=None, request = self.encode_request(d.items(), files) return self.send_request(request) - def upload_documentation(self, metadata, doc_dir): + def upload_documentation(self, metadata, doc_dir): # pragma: no cover """ Upload documentation to the index. @@ -499,7 +498,7 @@ def encode_request(self, fields, files): } return Request(self.url, body, headers) - def search(self, terms, operator=None): + def search(self, terms, operator=None): # pragma: no cover if isinstance(terms, string_types): terms = {'name': terms} rpc_proxy = ServerProxy(self.url, timeout=3.0) diff --git a/src/main/python/pybuilder/_vendor/distlib/locators.py b/src/main/python/pybuilder/_vendor/distlib/locators.py index c78bc9e23..966ebc0e3 100644 --- a/src/main/python/pybuilder/_vendor/distlib/locators.py +++ b/src/main/python/pybuilder/_vendor/distlib/locators.py @@ -1053,9 +1053,9 @@ def get_distribution_names(self): # We use a legacy scheme simply because most of the dists on PyPI use legacy -# versions which don't conform to PEP 426 / PEP 440. +# versions which don't conform to PEP 440. default_locator = AggregatingLocator( - JSONLocator(), + # JSONLocator(), # don't use as PEP 426 is withdrawn SimpleScrapingLocator('https://pypi.org/simple/', timeout=3.0), scheme='legacy') diff --git a/src/main/python/pybuilder/_vendor/distlib/metadata.py b/src/main/python/pybuilder/_vendor/distlib/metadata.py index 6a26b0ab2..c329e1977 100644 --- a/src/main/python/pybuilder/_vendor/distlib/metadata.py +++ b/src/main/python/pybuilder/_vendor/distlib/metadata.py @@ -5,7 +5,7 @@ # """Implementation of the Metadata for Python packages PEPs. -Supports all metadata formats (1.0, 1.1, 1.2, 1.3/2.1 and withdrawn 2.0). +Supports all metadata formats (1.0, 1.1, 1.2, 1.3/2.1 and 2.2). """ from __future__ import unicode_literals @@ -100,12 +100,17 @@ class MetadataInvalidError(DistlibException): _566_MARKERS = ('Description-Content-Type',) +_643_MARKERS = ('Dynamic', 'License-File') + +_643_FIELDS = _566_FIELDS + _643_MARKERS + _ALL_FIELDS = set() _ALL_FIELDS.update(_241_FIELDS) _ALL_FIELDS.update(_314_FIELDS) _ALL_FIELDS.update(_345_FIELDS) _ALL_FIELDS.update(_426_FIELDS) _ALL_FIELDS.update(_566_FIELDS) +_ALL_FIELDS.update(_643_FIELDS) EXTRA_RE = re.compile(r'''extra\s*==\s*("([^"]+)"|'([^']+)')''') @@ -121,7 +126,10 @@ def _version2fieldlist(version): # avoid adding field names if already there return _345_FIELDS + tuple(f for f in _566_FIELDS if f not in _345_FIELDS) elif version == '2.0': - return _426_FIELDS + raise ValueError('Metadata 2.0 is withdrawn and not supported') + # return _426_FIELDS + elif version == '2.2': + return _643_FIELDS raise MetadataUnrecognizedVersionError(version) @@ -139,7 +147,7 @@ def _has_marker(keys, markers): continue keys.append(key) - possible_versions = ['1.0', '1.1', '1.2', '1.3', '2.0', '2.1'] + possible_versions = ['1.0', '1.1', '1.2', '1.3', '2.1', '2.2'] # 2.0 removed # first let's try to see if a field is not part of one of the version for key in keys: @@ -159,9 +167,12 @@ def _has_marker(keys, markers): if key != 'Description': # In 2.1, description allowed after headers possible_versions.remove('2.1') logger.debug('Removed 2.1 due to %s', key) - if key not in _426_FIELDS and '2.0' in possible_versions: - possible_versions.remove('2.0') - logger.debug('Removed 2.0 due to %s', key) + if key not in _643_FIELDS and '2.2' in possible_versions: + possible_versions.remove('2.2') + logger.debug('Removed 2.2 due to %s', key) + # if key not in _426_FIELDS and '2.0' in possible_versions: + # possible_versions.remove('2.0') + # logger.debug('Removed 2.0 due to %s', key) # possible_version contains qualified versions if len(possible_versions) == 1: @@ -174,16 +185,18 @@ def _has_marker(keys, markers): is_1_1 = '1.1' in possible_versions and _has_marker(keys, _314_MARKERS) is_1_2 = '1.2' in possible_versions and _has_marker(keys, _345_MARKERS) is_2_1 = '2.1' in possible_versions and _has_marker(keys, _566_MARKERS) - is_2_0 = '2.0' in possible_versions and _has_marker(keys, _426_MARKERS) - if int(is_1_1) + int(is_1_2) + int(is_2_1) + int(is_2_0) > 1: - raise MetadataConflictError('You used incompatible 1.1/1.2/2.0/2.1 fields') + # is_2_0 = '2.0' in possible_versions and _has_marker(keys, _426_MARKERS) + is_2_2 = '2.2' in possible_versions and _has_marker(keys, _643_MARKERS) + if int(is_1_1) + int(is_1_2) + int(is_2_1) + int(is_2_2) > 1: + raise MetadataConflictError('You used incompatible 1.1/1.2/2.1/2.2 fields') - # we have the choice, 1.0, or 1.2, or 2.0 + # we have the choice, 1.0, or 1.2, 2.1 or 2.2 # - 1.0 has a broken Summary field but works with all tools # - 1.1 is to avoid # - 1.2 fixes Summary but has little adoption - # - 2.0 adds more features and is very new - if not is_1_1 and not is_1_2 and not is_2_1 and not is_2_0: + # - 2.1 adds more features + # - 2.2 is the latest + if not is_1_1 and not is_1_2 and not is_2_1 and not is_2_2: # we couldn't find any specific marker if PKG_INFO_PREFERRED_VERSION in possible_versions: return PKG_INFO_PREFERRED_VERSION @@ -193,8 +206,10 @@ def _has_marker(keys, markers): return '1.2' if is_2_1: return '2.1' + # if is_2_2: + # return '2.2' - return '2.0' + return '2.2' # This follows the rules about transforming keys as described in # https://www.python.org/dev/peps/pep-0566/#id17 @@ -210,7 +225,7 @@ def _has_marker(keys, markers): 'Requires', 'Provides', 'Obsoletes-Dist', 'Provides-Dist', 'Requires-Dist', 'Requires-External', 'Project-URL', 'Supported-Platform', 'Setup-Requires-Dist', - 'Provides-Extra', 'Extension') + 'Provides-Extra', 'Extension', 'License-File') _LISTTUPLEFIELDS = ('Project-URL',) _ELEMENTSFIELD = ('Keywords',) @@ -602,7 +617,7 @@ def __repr__(self): class Metadata(object): """ - The metadata of a release. This implementation uses 2.0 (JSON) + The metadata of a release. This implementation uses 2.1 metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. """ @@ -611,6 +626,8 @@ class Metadata(object): NAME_MATCHER = re.compile('^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$', re.I) + FIELDNAME_MATCHER = re.compile('^[A-Z]([0-9A-Z-]*[0-9A-Z])?$', re.I) + VERSION_MATCHER = PEP440_VERSION_RE SUMMARY_MATCHER = re.compile('.{1,2047}') @@ -638,6 +655,7 @@ class Metadata(object): 'name': (NAME_MATCHER, ('legacy',)), 'version': (VERSION_MATCHER, ('legacy',)), 'summary': (SUMMARY_MATCHER, ('legacy',)), + 'dynamic': (FIELDNAME_MATCHER, ('legacy',)), } __slots__ = ('_legacy', '_data', 'scheme') diff --git a/src/main/python/pybuilder/_vendor/distlib/scripts.py b/src/main/python/pybuilder/_vendor/distlib/scripts.py index 913912c7b..d2706242b 100644 --- a/src/main/python/pybuilder/_vendor/distlib/scripts.py +++ b/src/main/python/pybuilder/_vendor/distlib/scripts.py @@ -10,6 +10,8 @@ import re import struct import sys +import time +from zipfile import ZipInfo from .compat import sysconfig, detect_encoding, ZipFile from .resources import finder @@ -249,7 +251,13 @@ def _write_script(self, names, shebang, script_bytes, filenames, ext): launcher = self._get_launcher('w') stream = BytesIO() with ZipFile(stream, 'w') as zf: - zf.writestr('__main__.py', script_bytes) + source_date_epoch = os.environ.get('SOURCE_DATE_EPOCH') + if source_date_epoch: + date_time = time.gmtime(int(source_date_epoch))[:6] + zinfo = ZipInfo(filename='__main__.py', date_time=date_time) + zf.writestr(zinfo, script_bytes) + else: + zf.writestr('__main__.py', script_bytes) zip_data = stream.getvalue() script_bytes = launcher + shebang + zip_data for name in names: diff --git a/src/main/python/pybuilder/_vendor/distlib/t32.exe b/src/main/python/pybuilder/_vendor/distlib/t32.exe index 31baab619..0aaa386d7 100644 Binary files a/src/main/python/pybuilder/_vendor/distlib/t32.exe and b/src/main/python/pybuilder/_vendor/distlib/t32.exe differ diff --git a/src/main/python/pybuilder/_vendor/distlib/t64-arm.exe b/src/main/python/pybuilder/_vendor/distlib/t64-arm.exe index 3acd5ef9e..a759e270d 100644 Binary files a/src/main/python/pybuilder/_vendor/distlib/t64-arm.exe and b/src/main/python/pybuilder/_vendor/distlib/t64-arm.exe differ diff --git a/src/main/python/pybuilder/_vendor/distlib/t64.exe b/src/main/python/pybuilder/_vendor/distlib/t64.exe index ab825cc41..82fe2d99e 100644 Binary files a/src/main/python/pybuilder/_vendor/distlib/t64.exe and b/src/main/python/pybuilder/_vendor/distlib/t64.exe differ diff --git a/src/main/python/pybuilder/_vendor/distlib/w32.exe b/src/main/python/pybuilder/_vendor/distlib/w32.exe index 56827c1c4..f2e73aa0c 100644 Binary files a/src/main/python/pybuilder/_vendor/distlib/w32.exe and b/src/main/python/pybuilder/_vendor/distlib/w32.exe differ diff --git a/src/main/python/pybuilder/_vendor/distlib/w64-arm.exe b/src/main/python/pybuilder/_vendor/distlib/w64-arm.exe index 8eeb01199..b998321c4 100644 Binary files a/src/main/python/pybuilder/_vendor/distlib/w64-arm.exe and b/src/main/python/pybuilder/_vendor/distlib/w64-arm.exe differ diff --git a/src/main/python/pybuilder/_vendor/distlib/w64.exe b/src/main/python/pybuilder/_vendor/distlib/w64.exe index 5b82eff39..9a6b894db 100644 Binary files a/src/main/python/pybuilder/_vendor/distlib/w64.exe and b/src/main/python/pybuilder/_vendor/distlib/w64.exe differ diff --git a/src/main/python/pybuilder/_vendor/distlib/wheel.py b/src/main/python/pybuilder/_vendor/distlib/wheel.py index 48abfde5b..028c2d99b 100644 --- a/src/main/python/pybuilder/_vendor/distlib/wheel.py +++ b/src/main/python/pybuilder/_vendor/distlib/wheel.py @@ -11,7 +11,6 @@ import datetime from email import message_from_file import hashlib -import imp import json import logging import os @@ -61,10 +60,18 @@ def _derive_abi(): parts = ['cp', VER_SUFFIX] if sysconfig.get_config_var('Py_DEBUG'): parts.append('d') - if sysconfig.get_config_var('WITH_PYMALLOC'): - parts.append('m') - if sysconfig.get_config_var('Py_UNICODE_SIZE') == 4: - parts.append('u') + if IMP_PREFIX == 'cp': + vi = sys.version_info[:2] + if vi < (3, 8): + wpm = sysconfig.get_config_var('WITH_PYMALLOC') + if wpm is None: + wpm = True + if wpm: + parts.append('m') + if vi < (3, 3): + us = sysconfig.get_config_var('Py_UNICODE_SIZE') + if us == 4 or (us is None and sys.maxunicode == 0x10FFFF): + parts.append('u') return ''.join(parts) ABI = _derive_abi() del _derive_abi @@ -95,6 +102,29 @@ def _derive_abi(): else: to_posix = lambda o: o.replace(os.sep, '/') +if sys.version_info[0] < 3: + import imp +else: + imp = None + import importlib.machinery + import importlib.util + +def _get_suffixes(): + if imp: + return [s[0] for s in imp.get_suffixes()] + else: + return importlib.machinery.EXTENSION_SUFFIXES + +def _load_dynamic(name, path): + # https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly + if imp: + return imp.load_dynamic(name, path) + else: + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module class Mounter(object): def __init__(self): @@ -124,7 +154,7 @@ def load_module(self, fullname): else: if fullname not in self.libs: raise ImportError('unable to find extension for %s' % fullname) - result = imp.load_dynamic(fullname, self.libs[fullname]) + result = _load_dynamic(fullname, self.libs[fullname]) result.__loader__ = self parts = fullname.rsplit('.', 1) if len(parts) > 1: @@ -301,10 +331,9 @@ def get_hash(self, data, hash_kind=None): result = base64.urlsafe_b64encode(result).rstrip(b'=').decode('ascii') return hash_kind, result - def write_record(self, records, record_path, base): + def write_record(self, records, record_path, archive_record_path): records = list(records) # make a copy, as mutated - p = to_posix(os.path.relpath(record_path, base)) - records.append((p, '', '')) + records.append((archive_record_path, '', '')) with CSVWriter(record_path) as writer: for row in records: writer.writerow(row) @@ -321,8 +350,8 @@ def write_records(self, info, libdir, archive_paths): records.append((ap, digest, size)) p = os.path.join(distinfo, 'RECORD') - self.write_record(records, p, libdir) ap = to_posix(os.path.join(info_dir, 'RECORD')) + self.write_record(records, p, ap) archive_paths.append((ap, p)) def build_zip(self, pathname, archive_paths): @@ -965,7 +994,7 @@ def compatible_tags(): versions.append(''.join([major, str(minor)])) abis = [] - for suffix, _, _ in imp.get_suffixes(): + for suffix in _get_suffixes(): if suffix.startswith('.abi'): abis.append(suffix.split('.', 2)[1]) abis.sort() diff --git a/src/main/python/pybuilder/_vendor/filelock/version.py b/src/main/python/pybuilder/_vendor/filelock/version.py index 8f92aba40..651aebf9e 100644 --- a/src/main/python/pybuilder/_vendor/filelock/version.py +++ b/src/main/python/pybuilder/_vendor/filelock/version.py @@ -1,5 +1,5 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '3.7.0' -version_tuple = (3, 7, 0) +version = '3.7.1' +version_tuple = (3, 7, 1) diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/LICENSE b/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/LICENSE deleted file mode 100644 index be7e092b0..000000000 --- a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2017-2019 Jason R. Coombs, Barry Warsaw - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/RECORD b/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/RECORD deleted file mode 100644 index cd489e26b..000000000 --- a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/RECORD +++ /dev/null @@ -1,24 +0,0 @@ -importlib_metadata-4.11.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -importlib_metadata-4.11.4.dist-info/LICENSE,sha256=wNe6dAchmJ1VvVB8D9oTc-gHHadCuaSBAev36sYEM6U,571 -importlib_metadata-4.11.4.dist-info/METADATA,sha256=tUQ55W9IGxnnk8qvlR39IWo8ZCUBsc86MH5llw3JAog,3960 -importlib_metadata-4.11.4.dist-info/RECORD,, -importlib_metadata-4.11.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -importlib_metadata-4.11.4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -importlib_metadata-4.11.4.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19 -importlib_metadata/__init__.py,sha256=EzhWpbCgfp8OOwYERBAiESV77zVl1klS8L21txGEIIk,31365 -importlib_metadata/__pycache__/__init__.cpython-37.pyc,, -importlib_metadata/__pycache__/_adapters.cpython-37.pyc,, -importlib_metadata/__pycache__/_collections.cpython-37.pyc,, -importlib_metadata/__pycache__/_compat.cpython-37.pyc,, -importlib_metadata/__pycache__/_functools.cpython-37.pyc,, -importlib_metadata/__pycache__/_itertools.cpython-37.pyc,, -importlib_metadata/__pycache__/_meta.cpython-37.pyc,, -importlib_metadata/__pycache__/_text.cpython-37.pyc,, -importlib_metadata/_adapters.py,sha256=B6fCi5-8mLVDFUZj3krI5nAo-mKp1dH_qIavyIyFrJs,1862 -importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743 -importlib_metadata/_compat.py,sha256=EU2XCFBPFByuI0Of6XkAuBYbzqSyjwwwwqmsK4ccna0,1826 -importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895 -importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068 -importlib_metadata/_meta.py,sha256=_F48Hu_jFxkfKWz5wcYS8vO23qEygbVdF9r-6qh-hjE,1154 -importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166 -importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/INSTALLER b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/INSTALLER similarity index 100% rename from src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/INSTALLER rename to src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/INSTALLER diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/LICENSE b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/METADATA b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/METADATA similarity index 98% rename from src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/METADATA rename to src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/METADATA index 2dfaad933..c68a20dd3 100644 --- a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/METADATA +++ b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: importlib-metadata -Version: 4.11.4 +Version: 4.12.0 Summary: Read metadata from Python packages Home-page: https://github.com/python/importlib_metadata Author: Jason R. Coombs @@ -25,7 +25,7 @@ Requires-Dist: pytest (>=6) ; extra == 'testing' Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing' Requires-Dist: pytest-flake8 ; extra == 'testing' Requires-Dist: pytest-cov ; extra == 'testing' -Requires-Dist: pytest-enabler (>=1.0.1) ; extra == 'testing' +Requires-Dist: pytest-enabler (>=1.3) ; extra == 'testing' Requires-Dist: packaging ; extra == 'testing' Requires-Dist: pyfakefs ; extra == 'testing' Requires-Dist: flufl.flake8 ; extra == 'testing' diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/RECORD b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/RECORD new file mode 100644 index 000000000..9c40bf123 --- /dev/null +++ b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/RECORD @@ -0,0 +1,24 @@ +importlib_metadata-4.12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +importlib_metadata-4.12.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 +importlib_metadata-4.12.0.dist-info/METADATA,sha256=yrDKK_OYHbefwKP_XCpmmto2CHtqh7uygKjFc3-kVcM,3958 +importlib_metadata-4.12.0.dist-info/RECORD,, +importlib_metadata-4.12.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +importlib_metadata-4.12.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 +importlib_metadata-4.12.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19 +importlib_metadata/__init__.py,sha256=bfcTHMKmbYRIYLQ80BNARmTHlPE1zjGqOdzKXQywMWo,31383 +importlib_metadata/__pycache__/__init__.cpython-310.pyc,, +importlib_metadata/__pycache__/_adapters.cpython-310.pyc,, +importlib_metadata/__pycache__/_collections.cpython-310.pyc,, +importlib_metadata/__pycache__/_compat.cpython-310.pyc,, +importlib_metadata/__pycache__/_functools.cpython-310.pyc,, +importlib_metadata/__pycache__/_itertools.cpython-310.pyc,, +importlib_metadata/__pycache__/_meta.cpython-310.pyc,, +importlib_metadata/__pycache__/_text.cpython-310.pyc,, +importlib_metadata/_adapters.py,sha256=B6fCi5-8mLVDFUZj3krI5nAo-mKp1dH_qIavyIyFrJs,1862 +importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743 +importlib_metadata/_compat.py,sha256=9zOKf0eDgkCMnnaEhU5kQVxHd1P8BIYV7Stso7av5h8,1857 +importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895 +importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068 +importlib_metadata/_meta.py,sha256=_F48Hu_jFxkfKWz5wcYS8vO23qEygbVdF9r-6qh-hjE,1154 +importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166 +importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/REQUESTED b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/REQUESTED similarity index 100% rename from src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/REQUESTED rename to src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/REQUESTED diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/WHEEL b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/WHEEL similarity index 100% rename from src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/WHEEL rename to src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/WHEEL diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/top_level.txt b/src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/top_level.txt similarity index 100% rename from src/main/python/pybuilder/_vendor/importlib_metadata-4.11.4.dist-info/top_level.txt rename to src/main/python/pybuilder/_vendor/importlib_metadata-4.12.0.dist-info/top_level.txt diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata/__init__.py b/src/main/python/pybuilder/_vendor/importlib_metadata/__init__.py index 873f2b0a0..bbce11c0d 100644 --- a/src/main/python/pybuilder/_vendor/importlib_metadata/__init__.py +++ b/src/main/python/pybuilder/_vendor/importlib_metadata/__init__.py @@ -548,7 +548,7 @@ def locate_file(self, path): """ @classmethod - def from_name(cls, name): + def from_name(cls, name: str): """Return the Distribution for the given package name. :param name: The name of the distribution package to search for. @@ -556,13 +556,13 @@ def from_name(cls, name): package, if found. :raises PackageNotFoundError: When the named package's distribution metadata cannot be found. + :raises ValueError: When an invalid value is supplied for name. """ - for resolver in cls._discover_resolvers(): - dists = resolver(DistributionFinder.Context(name=name)) - dist = next(iter(dists), None) - if dist is not None: - return dist - else: + if not name: + raise ValueError("A distribution name is required.") + try: + return next(cls.discover(name=name)) + except StopIteration: raise PackageNotFoundError(name) @classmethod diff --git a/src/main/python/pybuilder/_vendor/importlib_metadata/_compat.py b/src/main/python/pybuilder/_vendor/importlib_metadata/_compat.py index 8fe4e4e3c..3d78566ea 100644 --- a/src/main/python/pybuilder/_vendor/importlib_metadata/_compat.py +++ b/src/main/python/pybuilder/_vendor/importlib_metadata/_compat.py @@ -8,6 +8,7 @@ try: from typing import Protocol except ImportError: # pragma: no cover + # Python 3.7 compatibility from typing_extensions import Protocol # type: ignore diff --git a/src/main/python/pybuilder/_vendor/importlib_resources/_common.py b/src/main/python/pybuilder/_vendor/importlib_resources/_common.py index a12e2c75d..423b0bb95 100644 --- a/src/main/python/pybuilder/_vendor/importlib_resources/_common.py +++ b/src/main/python/pybuilder/_vendor/importlib_resources/_common.py @@ -67,7 +67,14 @@ def from_package(package): @contextlib.contextmanager -def _tempfile(reader, suffix=''): +def _tempfile( + reader, + suffix='', + # gh-93353: Keep a reference to call os.remove() in late Python + # finalization. + *, + _os_remove=os.remove, +): # Not using tempfile.NamedTemporaryFile as it leads to deeper 'try' # blocks due to the need to close the temporary file to work on Windows # properly. @@ -81,18 +88,35 @@ def _tempfile(reader, suffix=''): yield pathlib.Path(raw_path) finally: try: - os.remove(raw_path) + _os_remove(raw_path) except FileNotFoundError: pass +def _temp_file(path): + return _tempfile(path.read_bytes, suffix=path.name) + + +def _is_present_dir(path: Traversable) -> bool: + """ + Some Traversables implement ``is_dir()`` to raise an + exception (i.e. ``FileNotFoundError``) when the + directory doesn't exist. This function wraps that call + to always return a boolean and only return True + if there's a dir and it exists. + """ + with contextlib.suppress(FileNotFoundError): + return path.is_dir() + return False + + @functools.singledispatch def as_file(path): """ Given a Traversable object, return that object as a path on the local file system in a context manager. """ - return _tempfile(path.read_bytes, suffix=path.name) + return _temp_dir(path) if _is_present_dir(path) else _temp_file(path) @as_file.register(pathlib.Path) @@ -102,3 +126,34 @@ def _(path): Degenerate behavior for pathlib.Path objects. """ yield path + + +@contextlib.contextmanager +def _temp_path(dir: tempfile.TemporaryDirectory): + """ + Wrap tempfile.TemporyDirectory to return a pathlib object. + """ + with dir as result: + yield pathlib.Path(result) + + +@contextlib.contextmanager +def _temp_dir(path): + """ + Given a traversable dir, recursively replicate the whole tree + to the file system in a context manager. + """ + assert path.is_dir() + with _temp_path(tempfile.TemporaryDirectory()) as temp_dir: + yield _write_contents(temp_dir, path) + + +def _write_contents(target, source): + child = target.joinpath(source.name) + if source.is_dir(): + child.mkdir() + for item in source.iterdir(): + _write_contents(child, item) + else: + child.open('wb').write(source.read_bytes()) + return child diff --git a/src/main/python/pybuilder/_vendor/importlib_resources/abc.py b/src/main/python/pybuilder/_vendor/importlib_resources/abc.py index 5e38ba61a..efa86ac66 100644 --- a/src/main/python/pybuilder/_vendor/importlib_resources/abc.py +++ b/src/main/python/pybuilder/_vendor/importlib_resources/abc.py @@ -1,5 +1,7 @@ import abc import io +import itertools +import pathlib from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional from ._compat import runtime_checkable, Protocol, StrPath @@ -50,6 +52,10 @@ def contents(self) -> Iterable[str]: raise FileNotFoundError +class TraversalError(Exception): + pass + + @runtime_checkable class Traversable(Protocol): """ @@ -92,7 +98,6 @@ def is_file(self) -> bool: Return True if self is a file """ - @abc.abstractmethod def joinpath(self, *descendants: StrPath) -> "Traversable": """ Return Traversable resolved with any descendants applied. @@ -101,6 +106,22 @@ def joinpath(self, *descendants: StrPath) -> "Traversable": and each may contain multiple levels separated by ``posixpath.sep`` (``/``). """ + if not descendants: + return self + names = itertools.chain.from_iterable( + path.parts for path in map(pathlib.PurePosixPath, descendants) + ) + target = next(names) + matches = ( + traversable for traversable in self.iterdir() if traversable.name == target + ) + try: + match = next(matches) + except StopIteration: + raise TraversalError( + "Target not found during traversal.", target, list(names) + ) + return match.joinpath(*names) def __truediv__(self, child: StrPath) -> "Traversable": """ diff --git a/src/main/python/pybuilder/_vendor/importlib_resources/readers.py b/src/main/python/pybuilder/_vendor/importlib_resources/readers.py index f1190ca45..ab34db740 100644 --- a/src/main/python/pybuilder/_vendor/importlib_resources/readers.py +++ b/src/main/python/pybuilder/_vendor/importlib_resources/readers.py @@ -82,15 +82,13 @@ def is_dir(self): def is_file(self): return False - def joinpath(self, child): - # first try to find child in current paths - for file in self.iterdir(): - if file.name == child: - return file - # if it does not exist, construct it with the first path - return self._paths[0] / child - - __truediv__ = joinpath + def joinpath(self, *descendants): + try: + return super().joinpath(*descendants) + except abc.TraversalError: + # One of the paths did not resolve (a directory does not exist). + # Just return something that will not exist. + return self._paths[0].joinpath(*descendants) def open(self, *args, **kwargs): raise FileNotFoundError(f'{self} is not a file') diff --git a/src/main/python/pybuilder/_vendor/importlib_resources/simple.py b/src/main/python/pybuilder/_vendor/importlib_resources/simple.py index d0fbf2377..b85e4694a 100644 --- a/src/main/python/pybuilder/_vendor/importlib_resources/simple.py +++ b/src/main/python/pybuilder/_vendor/importlib_resources/simple.py @@ -99,20 +99,6 @@ def iterdir(self): def open(self, *args, **kwargs): raise IsADirectoryError() - @staticmethod - def _flatten(compound_names): - for name in compound_names: - yield from name.split('/') - - def joinpath(self, *descendants): - if not descendants: - return self - names = self._flatten(descendants) - target = next(names) - return next( - traversable for traversable in self.iterdir() if traversable.name == target - ).joinpath(*names) - class TraversableReader(TraversableResources, SimpleReader): """ diff --git a/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_reader.py b/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_reader.py index fdb1b0150..78c860197 100644 --- a/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_reader.py +++ b/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_reader.py @@ -75,6 +75,11 @@ def test_join_path(self): str(path.joinpath('imaginary'))[len(prefix) + 1 :], os.path.join('namespacedata01', 'imaginary'), ) + self.assertEqual(path.joinpath(), path) + + def test_join_path_compound(self): + path = MultiplexedPath(self.folder) + assert not path.joinpath('imaginary/foo.py').exists() def test_repr(self): self.assertEqual( diff --git a/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_resource.py b/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_resource.py index d2d08aad8..3904ad155 100644 --- a/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_resource.py +++ b/src/main/python/pybuilder/_vendor/importlib_resources/tests/test_resource.py @@ -111,6 +111,14 @@ def test_submodule_contents_by_name(self): {'__init__.py', 'binary.file'}, ) + def test_as_file_directory(self): + with resources.as_file(resources.files('ziptestdata')) as data: + assert data.name == 'ziptestdata' + assert data.is_dir() + assert data.joinpath('subdirectory').is_dir() + assert len(list(data.iterdir())) + assert not data.parent.exists() + class ResourceFromZipsTest02(util.ZipSetupBase, unittest.TestCase): ZIP_MODULE = zipdata02 # type: ignore diff --git a/src/main/python/pybuilder/_vendor/six.py b/src/main/python/pybuilder/_vendor/six.py deleted file mode 100644 index 4e15675d8..000000000 --- a/src/main/python/pybuilder/_vendor/six.py +++ /dev/null @@ -1,998 +0,0 @@ -# Copyright (c) 2010-2020 Benjamin Peterson -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -"""Utilities for writing code that runs on Python 2 and 3""" - -from __future__ import absolute_import - -import functools -import itertools -import operator -import sys -import types - -__author__ = "Benjamin Peterson " -__version__ = "1.16.0" - - -# Useful for very coarse version differentiation. -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 -PY34 = sys.version_info[0:2] >= (3, 4) - -if PY3: - string_types = str, - integer_types = int, - class_types = type, - text_type = str - binary_type = bytes - - MAXSIZE = sys.maxsize -else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode - binary_type = str - - if sys.platform.startswith("java"): - # Jython always uses 32 bits. - MAXSIZE = int((1 << 31) - 1) - else: - # It's possible to have sizeof(long) != sizeof(Py_ssize_t). - class X(object): - - def __len__(self): - return 1 << 31 - try: - len(X()) - except OverflowError: - # 32-bit - MAXSIZE = int((1 << 31) - 1) - else: - # 64-bit - MAXSIZE = int((1 << 63) - 1) - del X - -if PY34: - from importlib.util import spec_from_loader -else: - spec_from_loader = None - - -def _add_doc(func, doc): - """Add documentation to a function.""" - func.__doc__ = doc - - -def _import_module(name): - """Import module, returning the module after the last dot.""" - __import__(name) - return sys.modules[name] - - -class _LazyDescr(object): - - def __init__(self, name): - self.name = name - - def __get__(self, obj, tp): - result = self._resolve() - setattr(obj, self.name, result) # Invokes __set__. - try: - # This is a bit ugly, but it avoids running this again by - # removing this descriptor. - delattr(obj.__class__, self.name) - except AttributeError: - pass - return result - - -class MovedModule(_LazyDescr): - - def __init__(self, name, old, new=None): - super(MovedModule, self).__init__(name) - if PY3: - if new is None: - new = name - self.mod = new - else: - self.mod = old - - def _resolve(self): - return _import_module(self.mod) - - def __getattr__(self, attr): - _module = self._resolve() - value = getattr(_module, attr) - setattr(self, attr, value) - return value - - -class _LazyModule(types.ModuleType): - - def __init__(self, name): - super(_LazyModule, self).__init__(name) - self.__doc__ = self.__class__.__doc__ - - def __dir__(self): - attrs = ["__doc__", "__name__"] - attrs += [attr.name for attr in self._moved_attributes] - return attrs - - # Subclasses should override this - _moved_attributes = [] - - -class MovedAttribute(_LazyDescr): - - def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): - super(MovedAttribute, self).__init__(name) - if PY3: - if new_mod is None: - new_mod = name - self.mod = new_mod - if new_attr is None: - if old_attr is None: - new_attr = name - else: - new_attr = old_attr - self.attr = new_attr - else: - self.mod = old_mod - if old_attr is None: - old_attr = name - self.attr = old_attr - - def _resolve(self): - module = _import_module(self.mod) - return getattr(module, self.attr) - - -class _SixMetaPathImporter(object): - - """ - A meta path importer to import six.moves and its submodules. - - This class implements a PEP302 finder and loader. It should be compatible - with Python 2.5 and all existing versions of Python3 - """ - - def __init__(self, six_module_name): - self.name = six_module_name - self.known_modules = {} - - def _add_module(self, mod, *fullnames): - for fullname in fullnames: - self.known_modules[self.name + "." + fullname] = mod - - def _get_module(self, fullname): - return self.known_modules[self.name + "." + fullname] - - def find_module(self, fullname, path=None): - if fullname in self.known_modules: - return self - return None - - def find_spec(self, fullname, path, target=None): - if fullname in self.known_modules: - return spec_from_loader(fullname, self) - return None - - def __get_module(self, fullname): - try: - return self.known_modules[fullname] - except KeyError: - raise ImportError("This loader does not know module " + fullname) - - def load_module(self, fullname): - try: - # in case of a reload - return sys.modules[fullname] - except KeyError: - pass - mod = self.__get_module(fullname) - if isinstance(mod, MovedModule): - mod = mod._resolve() - else: - mod.__loader__ = self - sys.modules[fullname] = mod - return mod - - def is_package(self, fullname): - """ - Return true, if the named module is a package. - - We need this method to get correct spec objects with - Python 3.4 (see PEP451) - """ - return hasattr(self.__get_module(fullname), "__path__") - - def get_code(self, fullname): - """Return None - - Required, if is_package is implemented""" - self.__get_module(fullname) # eventually raises ImportError - return None - get_source = get_code # same as get_code - - def create_module(self, spec): - return self.load_module(spec.name) - - def exec_module(self, module): - pass - -_importer = _SixMetaPathImporter(__name__) - - -class _MovedItems(_LazyModule): - - """Lazy loading of moved objects""" - __path__ = [] # mark as package - - -_moved_attributes = [ - MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), - MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), - MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), - MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), - MovedAttribute("intern", "__builtin__", "sys"), - MovedAttribute("map", "itertools", "builtins", "imap", "map"), - MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), - MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), - MovedAttribute("getoutput", "commands", "subprocess"), - MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), - MovedAttribute("reduce", "__builtin__", "functools"), - MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), - MovedAttribute("StringIO", "StringIO", "io"), - MovedAttribute("UserDict", "UserDict", "collections"), - MovedAttribute("UserList", "UserList", "collections"), - MovedAttribute("UserString", "UserString", "collections"), - MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), - MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), - MovedModule("builtins", "__builtin__"), - MovedModule("configparser", "ConfigParser"), - MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"), - MovedModule("copyreg", "copy_reg"), - MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), - MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"), - MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9) else "_thread"), - MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), - MovedModule("http_cookies", "Cookie", "http.cookies"), - MovedModule("html_entities", "htmlentitydefs", "html.entities"), - MovedModule("html_parser", "HTMLParser", "html.parser"), - MovedModule("http_client", "httplib", "http.client"), - MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), - MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"), - MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), - MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"), - MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), - MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), - MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), - MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), - MovedModule("cPickle", "cPickle", "pickle"), - MovedModule("queue", "Queue"), - MovedModule("reprlib", "repr"), - MovedModule("socketserver", "SocketServer"), - MovedModule("_thread", "thread", "_thread"), - MovedModule("tkinter", "Tkinter"), - MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), - MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), - MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), - MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), - MovedModule("tkinter_tix", "Tix", "tkinter.tix"), - MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"), - MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), - MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), - MovedModule("tkinter_colorchooser", "tkColorChooser", - "tkinter.colorchooser"), - MovedModule("tkinter_commondialog", "tkCommonDialog", - "tkinter.commondialog"), - MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), - MovedModule("tkinter_font", "tkFont", "tkinter.font"), - MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), - MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", - "tkinter.simpledialog"), - MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), - MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), - MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), - MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), - MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"), - MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"), -] -# Add windows specific modules. -if sys.platform == "win32": - _moved_attributes += [ - MovedModule("winreg", "_winreg"), - ] - -for attr in _moved_attributes: - setattr(_MovedItems, attr.name, attr) - if isinstance(attr, MovedModule): - _importer._add_module(attr, "moves." + attr.name) -del attr - -_MovedItems._moved_attributes = _moved_attributes - -moves = _MovedItems(__name__ + ".moves") -_importer._add_module(moves, "moves") - - -class Module_six_moves_urllib_parse(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_parse""" - - -_urllib_parse_moved_attributes = [ - MovedAttribute("ParseResult", "urlparse", "urllib.parse"), - MovedAttribute("SplitResult", "urlparse", "urllib.parse"), - MovedAttribute("parse_qs", "urlparse", "urllib.parse"), - MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), - MovedAttribute("urldefrag", "urlparse", "urllib.parse"), - MovedAttribute("urljoin", "urlparse", "urllib.parse"), - MovedAttribute("urlparse", "urlparse", "urllib.parse"), - MovedAttribute("urlsplit", "urlparse", "urllib.parse"), - MovedAttribute("urlunparse", "urlparse", "urllib.parse"), - MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), - MovedAttribute("quote", "urllib", "urllib.parse"), - MovedAttribute("quote_plus", "urllib", "urllib.parse"), - MovedAttribute("unquote", "urllib", "urllib.parse"), - MovedAttribute("unquote_plus", "urllib", "urllib.parse"), - MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"), - MovedAttribute("urlencode", "urllib", "urllib.parse"), - MovedAttribute("splitquery", "urllib", "urllib.parse"), - MovedAttribute("splittag", "urllib", "urllib.parse"), - MovedAttribute("splituser", "urllib", "urllib.parse"), - MovedAttribute("splitvalue", "urllib", "urllib.parse"), - MovedAttribute("uses_fragment", "urlparse", "urllib.parse"), - MovedAttribute("uses_netloc", "urlparse", "urllib.parse"), - MovedAttribute("uses_params", "urlparse", "urllib.parse"), - MovedAttribute("uses_query", "urlparse", "urllib.parse"), - MovedAttribute("uses_relative", "urlparse", "urllib.parse"), -] -for attr in _urllib_parse_moved_attributes: - setattr(Module_six_moves_urllib_parse, attr.name, attr) -del attr - -Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes - -_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"), - "moves.urllib_parse", "moves.urllib.parse") - - -class Module_six_moves_urllib_error(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_error""" - - -_urllib_error_moved_attributes = [ - MovedAttribute("URLError", "urllib2", "urllib.error"), - MovedAttribute("HTTPError", "urllib2", "urllib.error"), - MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), -] -for attr in _urllib_error_moved_attributes: - setattr(Module_six_moves_urllib_error, attr.name, attr) -del attr - -Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes - -_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"), - "moves.urllib_error", "moves.urllib.error") - - -class Module_six_moves_urllib_request(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_request""" - - -_urllib_request_moved_attributes = [ - MovedAttribute("urlopen", "urllib2", "urllib.request"), - MovedAttribute("install_opener", "urllib2", "urllib.request"), - MovedAttribute("build_opener", "urllib2", "urllib.request"), - MovedAttribute("pathname2url", "urllib", "urllib.request"), - MovedAttribute("url2pathname", "urllib", "urllib.request"), - MovedAttribute("getproxies", "urllib", "urllib.request"), - MovedAttribute("Request", "urllib2", "urllib.request"), - MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), - MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), - MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), - MovedAttribute("BaseHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), - MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), - MovedAttribute("FileHandler", "urllib2", "urllib.request"), - MovedAttribute("FTPHandler", "urllib2", "urllib.request"), - MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), - MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), - MovedAttribute("urlretrieve", "urllib", "urllib.request"), - MovedAttribute("urlcleanup", "urllib", "urllib.request"), - MovedAttribute("URLopener", "urllib", "urllib.request"), - MovedAttribute("FancyURLopener", "urllib", "urllib.request"), - MovedAttribute("proxy_bypass", "urllib", "urllib.request"), - MovedAttribute("parse_http_list", "urllib2", "urllib.request"), - MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"), -] -for attr in _urllib_request_moved_attributes: - setattr(Module_six_moves_urllib_request, attr.name, attr) -del attr - -Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes - -_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"), - "moves.urllib_request", "moves.urllib.request") - - -class Module_six_moves_urllib_response(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_response""" - - -_urllib_response_moved_attributes = [ - MovedAttribute("addbase", "urllib", "urllib.response"), - MovedAttribute("addclosehook", "urllib", "urllib.response"), - MovedAttribute("addinfo", "urllib", "urllib.response"), - MovedAttribute("addinfourl", "urllib", "urllib.response"), -] -for attr in _urllib_response_moved_attributes: - setattr(Module_six_moves_urllib_response, attr.name, attr) -del attr - -Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes - -_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"), - "moves.urllib_response", "moves.urllib.response") - - -class Module_six_moves_urllib_robotparser(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_robotparser""" - - -_urllib_robotparser_moved_attributes = [ - MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), -] -for attr in _urllib_robotparser_moved_attributes: - setattr(Module_six_moves_urllib_robotparser, attr.name, attr) -del attr - -Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes - -_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"), - "moves.urllib_robotparser", "moves.urllib.robotparser") - - -class Module_six_moves_urllib(types.ModuleType): - - """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" - __path__ = [] # mark as package - parse = _importer._get_module("moves.urllib_parse") - error = _importer._get_module("moves.urllib_error") - request = _importer._get_module("moves.urllib_request") - response = _importer._get_module("moves.urllib_response") - robotparser = _importer._get_module("moves.urllib_robotparser") - - def __dir__(self): - return ['parse', 'error', 'request', 'response', 'robotparser'] - -_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"), - "moves.urllib") - - -def add_move(move): - """Add an item to six.moves.""" - setattr(_MovedItems, move.name, move) - - -def remove_move(name): - """Remove item from six.moves.""" - try: - delattr(_MovedItems, name) - except AttributeError: - try: - del moves.__dict__[name] - except KeyError: - raise AttributeError("no such move, %r" % (name,)) - - -if PY3: - _meth_func = "__func__" - _meth_self = "__self__" - - _func_closure = "__closure__" - _func_code = "__code__" - _func_defaults = "__defaults__" - _func_globals = "__globals__" -else: - _meth_func = "im_func" - _meth_self = "im_self" - - _func_closure = "func_closure" - _func_code = "func_code" - _func_defaults = "func_defaults" - _func_globals = "func_globals" - - -try: - advance_iterator = next -except NameError: - def advance_iterator(it): - return it.next() -next = advance_iterator - - -try: - callable = callable -except NameError: - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) - - -if PY3: - def get_unbound_function(unbound): - return unbound - - create_bound_method = types.MethodType - - def create_unbound_method(func, cls): - return func - - Iterator = object -else: - def get_unbound_function(unbound): - return unbound.im_func - - def create_bound_method(func, obj): - return types.MethodType(func, obj, obj.__class__) - - def create_unbound_method(func, cls): - return types.MethodType(func, None, cls) - - class Iterator(object): - - def next(self): - return type(self).__next__(self) - - callable = callable -_add_doc(get_unbound_function, - """Get the function out of a possibly unbound function""") - - -get_method_function = operator.attrgetter(_meth_func) -get_method_self = operator.attrgetter(_meth_self) -get_function_closure = operator.attrgetter(_func_closure) -get_function_code = operator.attrgetter(_func_code) -get_function_defaults = operator.attrgetter(_func_defaults) -get_function_globals = operator.attrgetter(_func_globals) - - -if PY3: - def iterkeys(d, **kw): - return iter(d.keys(**kw)) - - def itervalues(d, **kw): - return iter(d.values(**kw)) - - def iteritems(d, **kw): - return iter(d.items(**kw)) - - def iterlists(d, **kw): - return iter(d.lists(**kw)) - - viewkeys = operator.methodcaller("keys") - - viewvalues = operator.methodcaller("values") - - viewitems = operator.methodcaller("items") -else: - def iterkeys(d, **kw): - return d.iterkeys(**kw) - - def itervalues(d, **kw): - return d.itervalues(**kw) - - def iteritems(d, **kw): - return d.iteritems(**kw) - - def iterlists(d, **kw): - return d.iterlists(**kw) - - viewkeys = operator.methodcaller("viewkeys") - - viewvalues = operator.methodcaller("viewvalues") - - viewitems = operator.methodcaller("viewitems") - -_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.") -_add_doc(itervalues, "Return an iterator over the values of a dictionary.") -_add_doc(iteritems, - "Return an iterator over the (key, value) pairs of a dictionary.") -_add_doc(iterlists, - "Return an iterator over the (key, [values]) pairs of a dictionary.") - - -if PY3: - def b(s): - return s.encode("latin-1") - - def u(s): - return s - unichr = chr - import struct - int2byte = struct.Struct(">B").pack - del struct - byte2int = operator.itemgetter(0) - indexbytes = operator.getitem - iterbytes = iter - import io - StringIO = io.StringIO - BytesIO = io.BytesIO - del io - _assertCountEqual = "assertCountEqual" - if sys.version_info[1] <= 1: - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" - _assertNotRegex = "assertNotRegexpMatches" - else: - _assertRaisesRegex = "assertRaisesRegex" - _assertRegex = "assertRegex" - _assertNotRegex = "assertNotRegex" -else: - def b(s): - return s - # Workaround for standalone backslash - - def u(s): - return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") - unichr = unichr - int2byte = chr - - def byte2int(bs): - return ord(bs[0]) - - def indexbytes(buf, i): - return ord(buf[i]) - iterbytes = functools.partial(itertools.imap, ord) - import StringIO - StringIO = BytesIO = StringIO.StringIO - _assertCountEqual = "assertItemsEqual" - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" - _assertNotRegex = "assertNotRegexpMatches" -_add_doc(b, """Byte literal""") -_add_doc(u, """Text literal""") - - -def assertCountEqual(self, *args, **kwargs): - return getattr(self, _assertCountEqual)(*args, **kwargs) - - -def assertRaisesRegex(self, *args, **kwargs): - return getattr(self, _assertRaisesRegex)(*args, **kwargs) - - -def assertRegex(self, *args, **kwargs): - return getattr(self, _assertRegex)(*args, **kwargs) - - -def assertNotRegex(self, *args, **kwargs): - return getattr(self, _assertNotRegex)(*args, **kwargs) - - -if PY3: - exec_ = getattr(moves.builtins, "exec") - - def reraise(tp, value, tb=None): - try: - if value is None: - value = tp() - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - finally: - value = None - tb = None - -else: - def exec_(_code_, _globs_=None, _locs_=None): - """Execute code in a namespace.""" - if _globs_ is None: - frame = sys._getframe(1) - _globs_ = frame.f_globals - if _locs_ is None: - _locs_ = frame.f_locals - del frame - elif _locs_ is None: - _locs_ = _globs_ - exec("""exec _code_ in _globs_, _locs_""") - - exec_("""def reraise(tp, value, tb=None): - try: - raise tp, value, tb - finally: - tb = None -""") - - -if sys.version_info[:2] > (3,): - exec_("""def raise_from(value, from_value): - try: - raise value from from_value - finally: - value = None -""") -else: - def raise_from(value, from_value): - raise value - - -print_ = getattr(moves.builtins, "print", None) -if print_ is None: - def print_(*args, **kwargs): - """The new-style print function for Python 2.4 and 2.5.""" - fp = kwargs.pop("file", sys.stdout) - if fp is None: - return - - def write(data): - if not isinstance(data, basestring): - data = str(data) - # If the file has an encoding, encode unicode with it. - if (isinstance(fp, file) and - isinstance(data, unicode) and - fp.encoding is not None): - errors = getattr(fp, "errors", None) - if errors is None: - errors = "strict" - data = data.encode(fp.encoding, errors) - fp.write(data) - want_unicode = False - sep = kwargs.pop("sep", None) - if sep is not None: - if isinstance(sep, unicode): - want_unicode = True - elif not isinstance(sep, str): - raise TypeError("sep must be None or a string") - end = kwargs.pop("end", None) - if end is not None: - if isinstance(end, unicode): - want_unicode = True - elif not isinstance(end, str): - raise TypeError("end must be None or a string") - if kwargs: - raise TypeError("invalid keyword arguments to print()") - if not want_unicode: - for arg in args: - if isinstance(arg, unicode): - want_unicode = True - break - if want_unicode: - newline = unicode("\n") - space = unicode(" ") - else: - newline = "\n" - space = " " - if sep is None: - sep = space - if end is None: - end = newline - for i, arg in enumerate(args): - if i: - write(sep) - write(arg) - write(end) -if sys.version_info[:2] < (3, 3): - _print = print_ - - def print_(*args, **kwargs): - fp = kwargs.get("file", sys.stdout) - flush = kwargs.pop("flush", False) - _print(*args, **kwargs) - if flush and fp is not None: - fp.flush() - -_add_doc(reraise, """Reraise an exception.""") - -if sys.version_info[0:2] < (3, 4): - # This does exactly the same what the :func:`py3:functools.update_wrapper` - # function does on Python versions after 3.2. It sets the ``__wrapped__`` - # attribute on ``wrapper`` object and it doesn't raise an error if any of - # the attributes mentioned in ``assigned`` and ``updated`` are missing on - # ``wrapped`` object. - def _update_wrapper(wrapper, wrapped, - assigned=functools.WRAPPER_ASSIGNMENTS, - updated=functools.WRAPPER_UPDATES): - for attr in assigned: - try: - value = getattr(wrapped, attr) - except AttributeError: - continue - else: - setattr(wrapper, attr, value) - for attr in updated: - getattr(wrapper, attr).update(getattr(wrapped, attr, {})) - wrapper.__wrapped__ = wrapped - return wrapper - _update_wrapper.__doc__ = functools.update_wrapper.__doc__ - - def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, - updated=functools.WRAPPER_UPDATES): - return functools.partial(_update_wrapper, wrapped=wrapped, - assigned=assigned, updated=updated) - wraps.__doc__ = functools.wraps.__doc__ - -else: - wraps = functools.wraps - - -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(type): - - def __new__(cls, name, this_bases, d): - if sys.version_info[:2] >= (3, 7): - # This version introduced PEP 560 that requires a bit - # of extra care (we mimic what is done by __build_class__). - resolved_bases = types.resolve_bases(bases) - if resolved_bases is not bases: - d['__orig_bases__'] = bases - else: - resolved_bases = bases - return meta(name, resolved_bases, d) - - @classmethod - def __prepare__(cls, name, this_bases): - return meta.__prepare__(name, bases) - return type.__new__(metaclass, 'temporary_class', (), {}) - - -def add_metaclass(metaclass): - """Class decorator for creating a class with a metaclass.""" - def wrapper(cls): - orig_vars = cls.__dict__.copy() - slots = orig_vars.get('__slots__') - if slots is not None: - if isinstance(slots, str): - slots = [slots] - for slots_var in slots: - orig_vars.pop(slots_var) - orig_vars.pop('__dict__', None) - orig_vars.pop('__weakref__', None) - if hasattr(cls, '__qualname__'): - orig_vars['__qualname__'] = cls.__qualname__ - return metaclass(cls.__name__, cls.__bases__, orig_vars) - return wrapper - - -def ensure_binary(s, encoding='utf-8', errors='strict'): - """Coerce **s** to six.binary_type. - - For Python 2: - - `unicode` -> encoded to `str` - - `str` -> `str` - - For Python 3: - - `str` -> encoded to `bytes` - - `bytes` -> `bytes` - """ - if isinstance(s, binary_type): - return s - if isinstance(s, text_type): - return s.encode(encoding, errors) - raise TypeError("not expecting type '%s'" % type(s)) - - -def ensure_str(s, encoding='utf-8', errors='strict'): - """Coerce *s* to `str`. - - For Python 2: - - `unicode` -> encoded to `str` - - `str` -> `str` - - For Python 3: - - `str` -> `str` - - `bytes` -> decoded to `str` - """ - # Optimization: Fast return for the common case. - if type(s) is str: - return s - if PY2 and isinstance(s, text_type): - return s.encode(encoding, errors) - elif PY3 and isinstance(s, binary_type): - return s.decode(encoding, errors) - elif not isinstance(s, (text_type, binary_type)): - raise TypeError("not expecting type '%s'" % type(s)) - return s - - -def ensure_text(s, encoding='utf-8', errors='strict'): - """Coerce *s* to six.text_type. - - For Python 2: - - `unicode` -> `unicode` - - `str` -> `unicode` - - For Python 3: - - `str` -> `str` - - `bytes` -> decoded to `str` - """ - if isinstance(s, binary_type): - return s.decode(encoding, errors) - elif isinstance(s, text_type): - return s - else: - raise TypeError("not expecting type '%s'" % type(s)) - - -def python_2_unicode_compatible(klass): - """ - A class decorator that defines __unicode__ and __str__ methods under Python 2. - Under Python 3 it does nothing. - - To support Python 2 and 3 with a single code base, define a __str__ method - returning text and apply this decorator to the class. - """ - if PY2: - if '__str__' not in klass.__dict__: - raise ValueError("@python_2_unicode_compatible cannot be applied " - "to %s because it doesn't define __str__()." % - klass.__name__) - klass.__unicode__ = klass.__str__ - klass.__str__ = lambda self: self.__unicode__().encode('utf-8') - return klass - - -# Complete the moves implementation. -# This code is at the end of this module to speed up module loading. -# Turn this module into a package. -__path__ = [] # required for PEP 302 and PEP 451 -__package__ = __name__ # see PEP 366 @ReservedAssignment -if globals().get("__spec__") is not None: - __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable -# Remove other six meta path importers, since they cause problems. This can -# happen if six is removed from sys.modules and then reloaded. (Setuptools does -# this for some reason.) -if sys.meta_path: - for i, importer in enumerate(sys.meta_path): - # Here's some real nastiness: Another "instance" of the six module might - # be floating around. Therefore, we can't use isinstance() to check for - # the six meta path importer, since the other six instance will have - # inserted an importer with different class. - if (type(importer).__name__ == "_SixMetaPathImporter" and - importer.name == __name__): - del sys.meta_path[i] - break - del i, importer -# Finally, add the importer to the meta path import hook. -sys.meta_path.append(_importer) diff --git a/src/main/python/pybuilder/_vendor/tblib/decorators.py b/src/main/python/pybuilder/_vendor/tblib/decorators.py index e67382499..29fdef2ce 100644 --- a/src/main/python/pybuilder/_vendor/tblib/decorators.py +++ b/src/main/python/pybuilder/_vendor/tblib/decorators.py @@ -1,7 +1,7 @@ import sys from functools import wraps -from ..six import reraise +from six import reraise from . import Traceback diff --git a/src/main/python/pybuilder/_vendor/typing_extensions.py b/src/main/python/pybuilder/_vendor/typing_extensions.py index dc0388196..31d3564e1 100644 --- a/src/main/python/pybuilder/_vendor/typing_extensions.py +++ b/src/main/python/pybuilder/_vendor/typing_extensions.py @@ -37,6 +37,7 @@ 'Counter', 'Deque', 'DefaultDict', + 'NamedTuple', 'OrderedDict', 'TypedDict', @@ -380,6 +381,46 @@ def _is_callable_members_only(cls): return all(callable(getattr(cls, attr, None)) for attr in _get_protocol_attrs(cls)) +def _maybe_adjust_parameters(cls): + """Helper function used in Protocol.__init_subclass__ and _TypedDictMeta.__new__. + + The contents of this function are very similar + to logic found in typing.Generic.__init_subclass__ + on the CPython main branch. + """ + tvars = [] + if '__orig_bases__' in cls.__dict__: + tvars = typing._collect_type_vars(cls.__orig_bases__) + # Look for Generic[T1, ..., Tn] or Protocol[T1, ..., Tn]. + # If found, tvars must be a subset of it. + # If not found, tvars is it. + # Also check for and reject plain Generic, + # and reject multiple Generic[...] and/or Protocol[...]. + gvars = None + for base in cls.__orig_bases__: + if (isinstance(base, typing._GenericAlias) and + base.__origin__ in (typing.Generic, Protocol)): + # for error messages + the_base = base.__origin__.__name__ + if gvars is not None: + raise TypeError( + "Cannot inherit from Generic[...]" + " and/or Protocol[...] multiple types.") + gvars = base.__parameters__ + if gvars is None: + gvars = tvars + else: + tvarset = set(tvars) + gvarset = set(gvars) + if not tvarset <= gvarset: + s_vars = ', '.join(str(t) for t in tvars if t not in gvarset) + s_args = ', '.join(str(g) for g in gvars) + raise TypeError(f"Some type variables ({s_vars}) are" + f" not listed in {the_base}[{s_args}]") + tvars = gvars + cls.__parameters__ = tuple(tvars) + + # 3.8+ if hasattr(typing, 'Protocol'): Protocol = typing.Protocol @@ -476,43 +517,13 @@ def __class_getitem__(cls, params): return typing._GenericAlias(cls, params) def __init_subclass__(cls, *args, **kwargs): - tvars = [] if '__orig_bases__' in cls.__dict__: error = typing.Generic in cls.__orig_bases__ else: error = typing.Generic in cls.__bases__ if error: raise TypeError("Cannot inherit from plain Generic") - if '__orig_bases__' in cls.__dict__: - tvars = typing._collect_type_vars(cls.__orig_bases__) - # Look for Generic[T1, ..., Tn] or Protocol[T1, ..., Tn]. - # If found, tvars must be a subset of it. - # If not found, tvars is it. - # Also check for and reject plain Generic, - # and reject multiple Generic[...] and/or Protocol[...]. - gvars = None - for base in cls.__orig_bases__: - if (isinstance(base, typing._GenericAlias) and - base.__origin__ in (typing.Generic, Protocol)): - # for error messages - the_base = base.__origin__.__name__ - if gvars is not None: - raise TypeError( - "Cannot inherit from Generic[...]" - " and/or Protocol[...] multiple types.") - gvars = base.__parameters__ - if gvars is None: - gvars = tvars - else: - tvarset = set(tvars) - gvarset = set(gvars) - if not tvarset <= gvarset: - s_vars = ', '.join(str(t) for t in tvars if t not in gvarset) - s_args = ', '.join(str(g) for g in gvars) - raise TypeError(f"Some type variables ({s_vars}) are" - f" not listed in {the_base}[{s_args}]") - tvars = gvars - cls.__parameters__ = tuple(tvars) + _maybe_adjust_parameters(cls) # Determine if this is a protocol or a concrete subclass. if not cls.__dict__.get('_is_protocol', None): @@ -613,6 +624,7 @@ def __index__(self) -> int: # keyword with old-style TypedDict(). See https://bugs.python.org/issue42059 # The standard library TypedDict below Python 3.11 does not store runtime # information about optional and required keys when using Required or NotRequired. + # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11. TypedDict = typing.TypedDict _TypedDictMeta = typing._TypedDictMeta is_typeddict = typing.is_typeddict @@ -695,8 +707,16 @@ def __new__(cls, name, bases, ns, total=True): # Subclasses and instances of TypedDict return actual dictionaries # via _dict_new. ns['__new__'] = _typeddict_new if name == 'TypedDict' else _dict_new + # Don't insert typing.Generic into __bases__ here, + # or Generic.__init_subclass__ will raise TypeError + # in the super().__new__() call. + # Instead, monkey-patch __bases__ onto the class after it's been created. tp_dict = super().__new__(cls, name, (dict,), ns) + if any(issubclass(base, typing.Generic) for base in bases): + tp_dict.__bases__ = (typing.Generic, dict) + _maybe_adjust_parameters(tp_dict) + annotations = {} own_annotations = ns.get('__annotations__', {}) msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type" @@ -1958,3 +1978,92 @@ def decorator(cls_or_fn): if not hasattr(typing, "TypeVarTuple"): typing._collect_type_vars = _collect_type_vars typing._check_generic = _check_generic + + +# Backport typing.NamedTuple as it exists in Python 3.11. +# In 3.11, the ability to define generic `NamedTuple`s was supported. +# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8. +if sys.version_info >= (3, 11): + NamedTuple = typing.NamedTuple +else: + def _caller(): + try: + return sys._getframe(2).f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): # For platforms without _getframe() + return None + + def _make_nmtuple(name, types, module, defaults=()): + fields = [n for n, t in types] + annotations = {n: typing._type_check(t, f"field {n} annotation must be a type") + for n, t in types} + nm_tpl = collections.namedtuple(name, fields, + defaults=defaults, module=module) + nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations + # The `_field_types` attribute was removed in 3.9; + # in earlier versions, it is the same as the `__annotations__` attribute + if sys.version_info < (3, 9): + nm_tpl._field_types = annotations + return nm_tpl + + _prohibited_namedtuple_fields = typing._prohibited + _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'}) + + class _NamedTupleMeta(type): + def __new__(cls, typename, bases, ns): + assert _NamedTuple in bases + for base in bases: + if base is not _NamedTuple and base is not typing.Generic: + raise TypeError( + 'can only inherit from a NamedTuple type and Generic') + bases = tuple(tuple if base is _NamedTuple else base for base in bases) + types = ns.get('__annotations__', {}) + default_names = [] + for field_name in types: + if field_name in ns: + default_names.append(field_name) + elif default_names: + raise TypeError(f"Non-default namedtuple field {field_name} " + f"cannot follow default field" + f"{'s' if len(default_names) > 1 else ''} " + f"{', '.join(default_names)}") + nm_tpl = _make_nmtuple( + typename, types.items(), + defaults=[ns[n] for n in default_names], + module=ns['__module__'] + ) + nm_tpl.__bases__ = bases + if typing.Generic in bases: + class_getitem = typing.Generic.__class_getitem__.__func__ + nm_tpl.__class_getitem__ = classmethod(class_getitem) + # update from user namespace without overriding special namedtuple attributes + for key in ns: + if key in _prohibited_namedtuple_fields: + raise AttributeError("Cannot overwrite NamedTuple attribute " + key) + elif key not in _special_namedtuple_fields and key not in nm_tpl._fields: + setattr(nm_tpl, key, ns[key]) + if typing.Generic in bases: + nm_tpl.__init_subclass__() + return nm_tpl + + def NamedTuple(__typename, __fields=None, **kwargs): + if __fields is None: + __fields = kwargs.items() + elif kwargs: + raise TypeError("Either list of fields or keywords" + " can be provided to NamedTuple, not both") + return _make_nmtuple(__typename, __fields, module=_caller()) + + NamedTuple.__doc__ = typing.NamedTuple.__doc__ + _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {}) + + # On 3.8+, alter the signature so that it matches typing.NamedTuple. + # The signature of typing.NamedTuple on >=3.8 is invalid syntax in Python 3.7, + # so just leave the signature as it is on 3.7. + if sys.version_info >= (3, 8): + NamedTuple.__text_signature__ = '(typename, fields=None, /, **kwargs)' + + def _namedtuple_mro_entries(bases): + assert NamedTuple in bases + return (_NamedTuple,) + + NamedTuple.__mro_entries__ = _namedtuple_mro_entries diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/RECORD b/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/RECORD deleted file mode 100644 index 3b9dedb32..000000000 --- a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/RECORD +++ /dev/null @@ -1,227 +0,0 @@ -../../bin/virtualenv,sha256=Vy6eH_yoCg8dIKR9hXBXtiyIHcYe9m3LYZa2tCn_XUg,324 -virtualenv-20.14.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -virtualenv-20.14.1.dist-info/LICENSE,sha256=XBWRk3jFsqqrexnOpw2M3HX3aHnjJFTkwDmfi3HRcek,1074 -virtualenv-20.14.1.dist-info/METADATA,sha256=tB-wA79-dY1Y9Mif6X8zMnba8CMIxnZSJSl_aO0wXfE,4656 -virtualenv-20.14.1.dist-info/RECORD,, -virtualenv-20.14.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv-20.14.1.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110 -virtualenv-20.14.1.dist-info/entry_points.txt,sha256=m8Y1t8mK98ioDAHaORnsE07DWBymoB6VT7AFXEasAjM,1731 -virtualenv-20.14.1.dist-info/top_level.txt,sha256=JV-LVlC8YeIw1DgiYI0hEot7tgFy5IWdKVcSG7NyzaI,11 -virtualenv-20.14.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 -virtualenv/__init__.py,sha256=SMvpjz4VJ3vJ_yfDDPzJAdi2GJOYd_UBXXuvImO07gk,205 -virtualenv/__main__.py,sha256=ypkUDuc5Q8XVyFpW-wEWgzx0LuAdK1yF2FsCUYlgPEk,2900 -virtualenv/__pycache__/__init__.cpython-37.pyc,, -virtualenv/__pycache__/__main__.cpython-37.pyc,, -virtualenv/__pycache__/info.cpython-37.pyc,, -virtualenv/__pycache__/report.cpython-37.pyc,, -virtualenv/__pycache__/version.cpython-37.pyc,, -virtualenv/activation/__init__.py,sha256=e1R_85pvWPaxrrHQSIl_Jfly1ZIM6w6_pind6MxoO-Y,486 -virtualenv/activation/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/__pycache__/activator.cpython-37.pyc,, -virtualenv/activation/__pycache__/via_template.cpython-37.pyc,, -virtualenv/activation/activator.py,sha256=noNMsjprUWDesvRVAyv63ITjDpPZw7UAkHWUl9KgyE0,1411 -virtualenv/activation/bash/__init__.py,sha256=7aC1WfvyzgFrIQs13jOuESuAbuiAnTsKkOe0iReRoaE,312 -virtualenv/activation/bash/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/bash/activate.sh,sha256=8NnbBA0VpoUEZzP09qO4Wp_3mfIq_j_7NXRGvJHBQq0,2179 -virtualenv/activation/batch/__init__.py,sha256=K0gVfwuXV7uoaMDL7moWGCq7uTDzI64giZzQQ8s2qnU,733 -virtualenv/activation/batch/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/batch/activate.bat,sha256=l4zrCkLCIGP8epTUs_rP9yvjrpXLDcIRoQUP2dwjOTc,1019 -virtualenv/activation/batch/deactivate.bat,sha256=6OznnO-HC2wnWUN7YAT-bj815zeKMXEPC0keyBYwKUU,510 -virtualenv/activation/batch/pydoc.bat,sha256=pVuxn8mn9P_Rd0349fiBEiwIuMvfJQSfgJ2dljUT2fA,24 -virtualenv/activation/cshell/__init__.py,sha256=pw4s5idqQhaEccPxadETEvilBcoxW-UkVQ-RNqPyVCQ,344 -virtualenv/activation/cshell/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/cshell/activate.csh,sha256=wm_0n7o83RXSTUJsWc2PPV33Yh9Gad8AJQIuRvL6EYg,1471 -virtualenv/activation/fish/__init__.py,sha256=hDkJq1P1wK2qm6BXydXWA9GMkBpj-TaejbKSceFnGZU,251 -virtualenv/activation/fish/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/fish/activate.fish,sha256=FkJpM8png8v9Sk3yGNJCcGzUKAAMF1Hz0dYrskut0z0,3056 -virtualenv/activation/nushell/__init__.py,sha256=glvGnNDjhHEzUhtcQNBtD_1lRWZvqJNQkWtuXvOiAJw,1078 -virtualenv/activation/nushell/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/nushell/activate.nu,sha256=DiQobNjAGe0kk1DqA8PGPBvCf2I5YBXC_6ExOywBn_k,2583 -virtualenv/activation/nushell/deactivate.nu,sha256=JrP9sYXczj4L8EFu10uwdkBFKR1_o2AyaW3jMP2UoPU,682 -virtualenv/activation/powershell/__init__.py,sha256=EA-73s5TUMkgxAhLwucFg3gsBwW5huNh7qB4I7uEU-U,256 -virtualenv/activation/powershell/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/powershell/activate.ps1,sha256=fitBG2YyeKTfkRn62CjocDb_PLjrgvi2FmpuBkFCcBw,1810 -virtualenv/activation/python/__init__.py,sha256=Uv53LqOrIT_2dO1FXcUYAnwH1eypG8CJ2InhSx1GRI4,1323 -virtualenv/activation/python/__pycache__/__init__.cpython-37.pyc,, -virtualenv/activation/python/__pycache__/activate_this.cpython-37.pyc,, -virtualenv/activation/python/activate_this.py,sha256=Xpz7exdGSjmWk0KfwHLofIpDPUtazNSNGrxT0-5ZG_s,1208 -virtualenv/activation/via_template.py,sha256=U8LgH-lyTjXIQBUdbd0xOZpXNICpiKhsfpiZwzQg7tU,2372 -virtualenv/app_data/__init__.py,sha256=OkJ7iHAF3-j6nDjomzaF3dPKO0Ulrua741V1BM7Igds,1468 -virtualenv/app_data/__pycache__/__init__.cpython-37.pyc,, -virtualenv/app_data/__pycache__/base.cpython-37.pyc,, -virtualenv/app_data/__pycache__/na.cpython-37.pyc,, -virtualenv/app_data/__pycache__/read_only.cpython-37.pyc,, -virtualenv/app_data/__pycache__/via_disk_folder.cpython-37.pyc,, -virtualenv/app_data/__pycache__/via_tempdir.cpython-37.pyc,, -virtualenv/app_data/base.py,sha256=dbS5Maob1-Cqs6EVqTmmbjAGeNYA1iw3pmdgYPWCJak,2129 -virtualenv/app_data/na.py,sha256=N2lR5VV4coM4Lym_E-nW_8Mh3x5-U6Jsq9x4wJn3wBM,1310 -virtualenv/app_data/read_only.py,sha256=MD-4Bl2SZZiGw0g8qZy0YLBGZGCuFYXnAEvWboF1PSc,1006 -virtualenv/app_data/via_disk_folder.py,sha256=UP1gx7WzG3USf_rQdKR9F5w_zuSPQQaqvbd58cqJHLw,5624 -virtualenv/app_data/via_tempdir.py,sha256=Z_-PoU7qeZe-idzi3nqys4FX0rfsRgOQ9_7XwX3hxSA,770 -virtualenv/config/__init__.py,sha256=8ArZTco6Meo0W9i4dqnwmDO8BJYTaHX7oQx1o06vCm4,57 -virtualenv/config/__pycache__/__init__.cpython-37.pyc,, -virtualenv/config/__pycache__/convert.cpython-37.pyc,, -virtualenv/config/__pycache__/env_var.cpython-37.pyc,, -virtualenv/config/__pycache__/ini.cpython-37.pyc,, -virtualenv/config/cli/__init__.py,sha256=8ArZTco6Meo0W9i4dqnwmDO8BJYTaHX7oQx1o06vCm4,57 -virtualenv/config/cli/__pycache__/__init__.cpython-37.pyc,, -virtualenv/config/cli/__pycache__/parser.cpython-37.pyc,, -virtualenv/config/cli/parser.py,sha256=HMbn7rDjM3knXhlJ-HP-79Q6mOOwJBgDuBA_GO842C0,4666 -virtualenv/config/convert.py,sha256=CWqO9z6j4ifUlAfadtB60xqTZpyAnPT0oDcpNomW7ek,2694 -virtualenv/config/env_var.py,sha256=h1oipwjVqHgelK0YI80q3RvckBibdKtvi2mw-OEMUqI,869 -virtualenv/config/ini.py,sha256=eHN1m4J6L-DvhhQwRjWbXelvYoZoCSSwqCms8gEemi4,2840 -virtualenv/create/__init__.py,sha256=8ArZTco6Meo0W9i4dqnwmDO8BJYTaHX7oQx1o06vCm4,57 -virtualenv/create/__pycache__/__init__.cpython-37.pyc,, -virtualenv/create/__pycache__/creator.cpython-37.pyc,, -virtualenv/create/__pycache__/debug.cpython-37.pyc,, -virtualenv/create/__pycache__/describe.cpython-37.pyc,, -virtualenv/create/__pycache__/pyenv_cfg.cpython-37.pyc,, -virtualenv/create/creator.py,sha256=rvdFhBeKZA0zCKoVFu83Rw7xa4PCPupwQ_kVLx7wjKQ,8928 -virtualenv/create/debug.py,sha256=ETOke8w4Ib8fiufAHVeOkH3v0zrztljw3WjGvZyE0Mk,3342 -virtualenv/create/describe.py,sha256=m_vJWNSpblQWQKluBiSp3EZrhFOCOOOZ49SXMXvukUA,3540 -virtualenv/create/pyenv_cfg.py,sha256=VsOGfzUpaVCO3J29zrhIeip4jZ4b7llbe45iOQAIRGg,1717 -virtualenv/create/via_global_ref/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/create/via_global_ref/__pycache__/__init__.cpython-37.pyc,, -virtualenv/create/via_global_ref/__pycache__/_virtualenv.cpython-37.pyc,, -virtualenv/create/via_global_ref/__pycache__/api.cpython-37.pyc,, -virtualenv/create/via_global_ref/__pycache__/store.cpython-37.pyc,, -virtualenv/create/via_global_ref/__pycache__/venv.cpython-37.pyc,, -virtualenv/create/via_global_ref/_virtualenv.py,sha256=zlfV4Nm11zVstC2nRQuo-TWb32k-M19MkhYmlDx35k0,5626 -virtualenv/create/via_global_ref/api.py,sha256=5MPq3XJBuUOBj53oIigeWWPm68M-J_E644WWbz37qOU,4357 -virtualenv/create/via_global_ref/builtin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/create/via_global_ref/builtin/__pycache__/__init__.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/__pycache__/builtin_way.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/__pycache__/ref.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/__pycache__/via_global_self_do.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/builtin_way.py,sha256=hO22nT-itVoYiy8wXrXXYzHw86toCp_Uq-cURR7w6ck,546 -virtualenv/create/via_global_ref/builtin/cpython/__init__.py,sha256=8ArZTco6Meo0W9i4dqnwmDO8BJYTaHX7oQx1o06vCm4,57 -virtualenv/create/via_global_ref/builtin/cpython/__pycache__/__init__.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/cpython/__pycache__/common.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/cpython/__pycache__/cpython2.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/cpython/__pycache__/cpython3.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/cpython/__pycache__/mac_os.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/cpython/common.py,sha256=U7EvB9-2DlOQTGrTyPrEcItEbJ1sFBzo1EAOcAIjQ5Q,2392 -virtualenv/create/via_global_ref/builtin/cpython/cpython2.py,sha256=NixgnZITjDP8qBWlnN40lUTeaPNoDUKPSS2ByUBs7Fk,3752 -virtualenv/create/via_global_ref/builtin/cpython/cpython3.py,sha256=jz4mbuhu9BcbcZSwmKBT8eSIvKi6kgkx_V-fuAmtmjc,3312 -virtualenv/create/via_global_ref/builtin/cpython/mac_os.py,sha256=4dhgLwcej41dhvzenQgGEC5I6E29MyjLkiJkn01zx7w,14767 -virtualenv/create/via_global_ref/builtin/pypy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/create/via_global_ref/builtin/pypy/__pycache__/__init__.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/pypy/__pycache__/common.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/pypy/__pycache__/pypy2.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/pypy/__pycache__/pypy3.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/pypy/common.py,sha256=t7XRfNtWFuVpZsnBAc-9Mgc-UXN8gbFs514jQ9viqsU,1762 -virtualenv/create/via_global_ref/builtin/pypy/pypy2.py,sha256=YbakUalkwuVVJp0leN1Kuuk3hzx74sm8kzOzviTNSBc,3725 -virtualenv/create/via_global_ref/builtin/pypy/pypy3.py,sha256=JpLoagxTjGsPuE9yrx2CskrvDZdBjR2HVVqXC1Kh-l4,3061 -virtualenv/create/via_global_ref/builtin/python2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/create/via_global_ref/builtin/python2/__pycache__/__init__.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/python2/__pycache__/python2.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/python2/__pycache__/site.cpython-37.pyc,, -virtualenv/create/via_global_ref/builtin/python2/python2.py,sha256=jkJwmkeJVTzwzo95eMIptTfdBA-qmyIqZcpt48iOitU,4276 -virtualenv/create/via_global_ref/builtin/python2/site.py,sha256=4kiq0cs57rbrqtFBsl7MyyGB2G2zjWn-1CHuH8C7gPQ,6903 -virtualenv/create/via_global_ref/builtin/ref.py,sha256=xCTICJhE-OiopBxl6ymo1P1NqgK3KEF8ZUOtQDtDTVA,5477 -virtualenv/create/via_global_ref/builtin/via_global_self_do.py,sha256=d569fX7fjq5vHvGGXDjo-1Xi__HhqU2xjDJOuYrmGjw,4552 -virtualenv/create/via_global_ref/store.py,sha256=cqLBEhQ979xHnlidqmxlDjsvj2Wr-mBo7shvGQSEBxU,685 -virtualenv/create/via_global_ref/venv.py,sha256=p5RkDcXhr1pmOwnl1dpS06UYHmfNVy2ld4sTwsYjYWU,2955 -virtualenv/discovery/__init__.py,sha256=8ArZTco6Meo0W9i4dqnwmDO8BJYTaHX7oQx1o06vCm4,57 -virtualenv/discovery/__pycache__/__init__.cpython-37.pyc,, -virtualenv/discovery/__pycache__/builtin.cpython-37.pyc,, -virtualenv/discovery/__pycache__/cached_py_info.cpython-37.pyc,, -virtualenv/discovery/__pycache__/discover.cpython-37.pyc,, -virtualenv/discovery/__pycache__/py_info.cpython-37.pyc,, -virtualenv/discovery/__pycache__/py_spec.cpython-37.pyc,, -virtualenv/discovery/builtin.py,sha256=LYvYqlyfrzULHeAwm4J4B9y4hLJHczNsivMtvsCoX78,6384 -virtualenv/discovery/cached_py_info.py,sha256=Lo74BQutsLR8z2JFKXdX6HizKrP5-sxsPCCVQZRzB8Q,5312 -virtualenv/discovery/discover.py,sha256=dq-yReN-vZHs9ZCBEOHN97KZErE2K26bPZRfVnNESIU,1241 -virtualenv/discovery/py_info.py,sha256=viibkMm0oOv4uREUE8qYpYPMdJPRrJ5WmELoYUNW0aY,23377 -virtualenv/discovery/py_spec.py,sha256=wQhLzCfXoSPsAAO9nm5-I2lNolVDux4W2vPSUfJGjlc,4790 -virtualenv/discovery/windows/__init__.py,sha256=9LjYTjiPygcERmWUugyHcv5jHmZSfHO3H2RvwzIvQvU,1200 -virtualenv/discovery/windows/__pycache__/__init__.cpython-37.pyc,, -virtualenv/discovery/windows/__pycache__/pep514.cpython-37.pyc,, -virtualenv/discovery/windows/pep514.py,sha256=YYiaJzo-XuMtO78BMFMAudqkeJiLQkFnUTOuQZ5lJz8,5451 -virtualenv/info.py,sha256=bM4pRJWf-UUkJojD53zW4PjUJAUqgycegr9kYawljms,1995 -virtualenv/report.py,sha256=z7Jwg6iYLnyioSIY_G4Yt_ZxcKmJNEAoWCEHpoFcaYQ,1445 -virtualenv/run/__init__.py,sha256=yRu6KoU7JGlyg5zFTa51aiYKIq36tUphxHaHzmSdjbU,6090 -virtualenv/run/__pycache__/__init__.cpython-37.pyc,, -virtualenv/run/__pycache__/session.cpython-37.pyc,, -virtualenv/run/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/run/plugin/__pycache__/__init__.cpython-37.pyc,, -virtualenv/run/plugin/__pycache__/activators.cpython-37.pyc,, -virtualenv/run/plugin/__pycache__/base.cpython-37.pyc,, -virtualenv/run/plugin/__pycache__/creators.cpython-37.pyc,, -virtualenv/run/plugin/__pycache__/discovery.cpython-37.pyc,, -virtualenv/run/plugin/__pycache__/seeders.cpython-37.pyc,, -virtualenv/run/plugin/activators.py,sha256=f6ZdG-Na6_jquTuG-E7kT40CAknGeB7YLgZzIPnDbsM,2225 -virtualenv/run/plugin/base.py,sha256=nm5_Yal-XMFYmIxZ7HPpB6tv7cXih1aYHen-PHMS9oU,2277 -virtualenv/run/plugin/creators.py,sha256=PIxJ85KmrQU7lUO-r8Znxbb4lTEzwHggc9lcDqmt2tc,3494 -virtualenv/run/plugin/discovery.py,sha256=M1S8CZPqUsIpJ88FT8CyGB32lRuflEY5pgK_XcCnK60,1156 -virtualenv/run/plugin/seeders.py,sha256=c1mhzu0HNzKdif6YUV35fuAOS0XHFJz3TtccLW5fWG0,1074 -virtualenv/run/session.py,sha256=S4NZiHzij1vp895mN9s9ZwYobJjjdP37QOHCb1o-Ufo,2563 -virtualenv/seed/__init__.py,sha256=8ArZTco6Meo0W9i4dqnwmDO8BJYTaHX7oQx1o06vCm4,57 -virtualenv/seed/__pycache__/__init__.cpython-37.pyc,, -virtualenv/seed/__pycache__/seeder.cpython-37.pyc,, -virtualenv/seed/embed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/seed/embed/__pycache__/__init__.cpython-37.pyc,, -virtualenv/seed/embed/__pycache__/base_embed.cpython-37.pyc,, -virtualenv/seed/embed/__pycache__/pip_invoke.cpython-37.pyc,, -virtualenv/seed/embed/base_embed.py,sha256=46mWtqWj_MjOQEqMJyosL0RWGL6HwrHAL2r1Jxc9DuI,4182 -virtualenv/seed/embed/pip_invoke.py,sha256=6pRRy3_jmGRKc1L7TDbqoXIHy_2_X6t7p_dF27I4cWs,2167 -virtualenv/seed/embed/via_app_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/seed/embed/via_app_data/__pycache__/__init__.cpython-37.pyc,, -virtualenv/seed/embed/via_app_data/__pycache__/via_app_data.cpython-37.pyc,, -virtualenv/seed/embed/via_app_data/pip_install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -virtualenv/seed/embed/via_app_data/pip_install/__pycache__/__init__.cpython-37.pyc,, -virtualenv/seed/embed/via_app_data/pip_install/__pycache__/base.cpython-37.pyc,, -virtualenv/seed/embed/via_app_data/pip_install/__pycache__/copy.cpython-37.pyc,, -virtualenv/seed/embed/via_app_data/pip_install/__pycache__/symlink.cpython-37.pyc,, -virtualenv/seed/embed/via_app_data/pip_install/base.py,sha256=ZZDgaZxWwYAqCHwlYaKHDRJaNoWV0vSxilsvkjjWNjY,8481 -virtualenv/seed/embed/via_app_data/pip_install/copy.py,sha256=gG2NePFHOYh-bsCf6TpsaQ_qrYhdBy67k0RWuwHSAwo,1307 -virtualenv/seed/embed/via_app_data/pip_install/symlink.py,sha256=wHCpfKobvjjaZLUSwM3FSCblZfiBFw4IQYsxwlfEEu0,2362 -virtualenv/seed/embed/via_app_data/via_app_data.py,sha256=w2Xtd56g1AfntfxNZtfFlg2t8yqrl5zTzvLo2xMiR94,6032 -virtualenv/seed/seeder.py,sha256=YAxyIOONsXRJrwzL8GbfSOoZjIMR7fcPREVyE2Tn3iQ,1209 -virtualenv/seed/wheels/__init__.py,sha256=1J7el7lNjAwGxM4dmricrbVhSbYxs5sPzv9PTx2A6qA,226 -virtualenv/seed/wheels/__pycache__/__init__.cpython-37.pyc,, -virtualenv/seed/wheels/__pycache__/acquire.cpython-37.pyc,, -virtualenv/seed/wheels/__pycache__/bundle.cpython-37.pyc,, -virtualenv/seed/wheels/__pycache__/periodic_update.cpython-37.pyc,, -virtualenv/seed/wheels/__pycache__/util.cpython-37.pyc,, -virtualenv/seed/wheels/acquire.py,sha256=NsQ-uf-h4vHRIvpEBw9h5foWEpcLPKnqcx4iDkIqXkY,4737 -virtualenv/seed/wheels/bundle.py,sha256=ovNzr-J4zn1EEvhIse4zeElYqrzUB_lyl-noZq_mk_I,1887 -virtualenv/seed/wheels/embed/__init__.py,sha256=0hcXHQnVq_8ZN-ca9xmHoJq2LNQKw9nAfmCytKJyNIs,1968 -virtualenv/seed/wheels/embed/__pycache__/__init__.cpython-37.pyc,, -virtualenv/seed/wheels/embed/pip-20.3.4-py2.py3-none-any.whl,sha256=IXrlFhoOCMD7hzhYgG40eMl3XK_85RaLUOyIXjWMGZ0,1522101 -virtualenv/seed/wheels/embed/pip-21.3.1-py3-none-any.whl,sha256=3q8y3Nmrgh41nNgzB4a80HdgS1xXMMCwlu2kb5XCSi0,1723581 -virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl,sha256=xqyg8vCBNj9onwQdkNqyoHqaB_uEAoTbIhgRelLagAs,2123599 -virtualenv/seed/wheels/embed/setuptools-44.1.1-py2.py3-none-any.whl,sha256=J6cUwJJTE05gpvpoEw94xwN-VWLE8h-PMY8q6QDRUtU,583493 -virtualenv/seed/wheels/embed/setuptools-50.3.2-py3-none-any.whl,sha256=LCQqCFb7rX775WDfSnrdkyTzQM9I30NlHpYEkkRmeUo,785194 -virtualenv/seed/wheels/embed/setuptools-59.6.0-py3-none-any.whl,sha256=TOkvHh-PASM-6ZUsBPa4HR4Ck51uG0iEKBVJdKTQeD4,952597 -virtualenv/seed/wheels/embed/setuptools-62.1.0-py3-none-any.whl,sha256=JurX0fk-_A-MgE2fr6--SkSxeVgKcQV1SyRRVfmvBag,1144059 -virtualenv/seed/wheels/embed/wheel-0.37.1-py2.py3-none-any.whl,sha256=S9zX2EATgIYSbNCSVNxhlftPxvAcBQodcjbyYw2x0io,35301 -virtualenv/seed/wheels/periodic_update.py,sha256=JHR82w7TSEJaqa73hgoRDloZepa8gRH9k7nWMzOCAVk,15361 -virtualenv/seed/wheels/util.py,sha256=Zdo76KEDqbNmM5u9JTuyu5uzEN_fQ4oj6qHOt0h0o1M,3960 -virtualenv/util/__init__.py,sha256=om6Hs2lH5igf5lkcSmQFiU7iMZ0Wx4dmSlMc6XW_Llg,199 -virtualenv/util/__pycache__/__init__.cpython-37.pyc,, -virtualenv/util/__pycache__/error.cpython-37.pyc,, -virtualenv/util/__pycache__/lock.cpython-37.pyc,, -virtualenv/util/__pycache__/six.cpython-37.pyc,, -virtualenv/util/__pycache__/zipapp.cpython-37.pyc,, -virtualenv/util/error.py,sha256=SRSZlXvMYQuJwxoUfNhlAyo3VwrAnIsZemSwPOxpjns,352 -virtualenv/util/lock.py,sha256=qjbBwtJFbNrqapalxtzEnAEhqOapATmEw27jKsuvSIQ,4787 -virtualenv/util/path/__init__.py,sha256=2aA04ZAJ53nk3ZKPxvL_DvOwismyH8r_WCujrObxT5o,401 -virtualenv/util/path/__pycache__/__init__.cpython-37.pyc,, -virtualenv/util/path/__pycache__/_permission.cpython-37.pyc,, -virtualenv/util/path/__pycache__/_sync.cpython-37.pyc,, -virtualenv/util/path/__pycache__/_win.cpython-37.pyc,, -virtualenv/util/path/_pathlib/__init__.py,sha256=XqzX7bagsBo3dNdzW8TTlkNzQf-pjSxvWbVPFSYUvb0,340 -virtualenv/util/path/_pathlib/__pycache__/__init__.cpython-37.pyc,, -virtualenv/util/path/_pathlib/__pycache__/via_os_path.cpython-37.pyc,, -virtualenv/util/path/_pathlib/via_os_path.py,sha256=vprJSVjVwxYB8vjBDNbnUg-Z_0RZpZbXEgRcuER2-as,3843 -virtualenv/util/path/_permission.py,sha256=XpO2vGAk_92_biD4MEQcAQq2Zc8_rpm3M3n_hMUA1rw,745 -virtualenv/util/path/_sync.py,sha256=G-LJ8gZBL8cbYD6PMZuUw7gudKPmvKW6vsq6CkvUUH4,2392 -virtualenv/util/path/_win.py,sha256=cxXH1z5pyqwOlcq8PmRC38ASfB1QZjEyPEF3aQmXRb8,709 -virtualenv/util/six.py,sha256=smZ7k2iTE9KuA4ETi1974s1NsWn_rZehlYNmgLbK4f0,1464 -virtualenv/util/subprocess/__init__.py,sha256=1UmFrdBv2sVeUfZbDcO2yZpe28AE0ULOu9dRKlpJaa0,801 -virtualenv/util/subprocess/__pycache__/__init__.cpython-37.pyc,, -virtualenv/util/subprocess/__pycache__/_win_subprocess.cpython-37.pyc,, -virtualenv/util/subprocess/_win_subprocess.py,sha256=nnYCcATKY_5ektDgGlk6OTdDQNyF_onbpfzCf13J5Qs,5697 -virtualenv/util/zipapp.py,sha256=jtf4Vn7XBnjPs_B_ObIQv_x4pFlIlPKAWHYLFV59h6U,1054 -virtualenv/version.py,sha256=emnFaRGWPlu02uh8ODW7DuOS1AbEaEBaWWwJ18ozoDw,66 diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/INSTALLER b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/INSTALLER similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/INSTALLER rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/INSTALLER diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/LICENSE b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/LICENSE similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/LICENSE rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/LICENSE diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/METADATA b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/METADATA similarity index 90% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/METADATA rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/METADATA index 7805906ac..74d041edf 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/METADATA +++ b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: virtualenv -Version: 20.14.1 +Version: 20.16.2 Summary: Virtual Python Environment builder Home-page: https://virtualenv.pypa.io/ Author: Bernat Gabor @@ -18,10 +18,8 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 @@ -32,14 +30,12 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities -Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7 +Requires-Python: >=3.6 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: distlib (<1,>=0.3.1) Requires-Dist: filelock (<4,>=3.2) Requires-Dist: platformdirs (<3,>=2) -Requires-Dist: six (<2,>=1.9.0) -Requires-Dist: pathlib2 (<3,>=2.3.3) ; python_version < "3.4" and sys_platform != "win32" Requires-Dist: importlib-resources (>=1.0) ; python_version < "3.7" Requires-Dist: importlib-metadata (>=0.12) ; python_version < "3.8" Provides-Extra: docs @@ -52,13 +48,13 @@ Provides-Extra: testing Requires-Dist: coverage (>=4) ; extra == 'testing' Requires-Dist: coverage-enable-subprocess (>=1) ; extra == 'testing' Requires-Dist: flaky (>=3) ; extra == 'testing' +Requires-Dist: packaging (>=20.0) ; extra == 'testing' Requires-Dist: pytest (>=4) ; extra == 'testing' Requires-Dist: pytest-env (>=0.6.2) ; extra == 'testing' Requires-Dist: pytest-freezegun (>=0.4.1) ; extra == 'testing' Requires-Dist: pytest-mock (>=2) ; extra == 'testing' Requires-Dist: pytest-randomly (>=1) ; extra == 'testing' Requires-Dist: pytest-timeout (>=1) ; extra == 'testing' -Requires-Dist: packaging (>=20.0) ; (python_version > "3.4") and extra == 'testing' # virtualenv @@ -86,5 +82,3 @@ A tool for creating isolated `virtual` python environments. Everyone interacting in the virtualenv project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [PSF Code of Conduct](https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md). - - diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/RECORD b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/RECORD new file mode 100644 index 000000000..a2300ad6a --- /dev/null +++ b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/RECORD @@ -0,0 +1,219 @@ +../../bin/virtualenv,sha256=Z1aFhTTEkXgMto_S-O9vHpgSvlLICMP6dWuuq9WzmwY,324 +virtualenv-20.16.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +virtualenv-20.16.2.dist-info/LICENSE,sha256=XBWRk3jFsqqrexnOpw2M3HX3aHnjJFTkwDmfi3HRcek,1074 +virtualenv-20.16.2.dist-info/METADATA,sha256=cjNMD_LLUmpNu8rqeXiiOLHDXDCqhzjfUwST23UVGNA,4371 +virtualenv-20.16.2.dist-info/RECORD,, +virtualenv-20.16.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv-20.16.2.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110 +virtualenv-20.16.2.dist-info/entry_points.txt,sha256=m8Y1t8mK98ioDAHaORnsE07DWBymoB6VT7AFXEasAjM,1731 +virtualenv-20.16.2.dist-info/top_level.txt,sha256=JV-LVlC8YeIw1DgiYI0hEot7tgFy5IWdKVcSG7NyzaI,11 +virtualenv-20.16.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +virtualenv/__init__.py,sha256=6hn2jM8WZblNlIkea3tD_WEzHy4icbAldxiqvGqJsG8,147 +virtualenv/__main__.py,sha256=zsOAnTAdAfDA0Q2maGFWekPyb_iFd9ztZbL6bMfLvZ4,2529 +virtualenv/__pycache__/__init__.cpython-310.pyc,, +virtualenv/__pycache__/__main__.cpython-310.pyc,, +virtualenv/__pycache__/info.cpython-310.pyc,, +virtualenv/__pycache__/report.cpython-310.pyc,, +virtualenv/__pycache__/version.cpython-310.pyc,, +virtualenv/activation/__init__.py,sha256=GUVO7jEC_pLzdFhI3hXuWJQUcpj4kWsJ8CFuWkp4Yfk,428 +virtualenv/activation/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/__pycache__/activator.cpython-310.pyc,, +virtualenv/activation/__pycache__/via_template.cpython-310.pyc,, +virtualenv/activation/activator.py,sha256=EuECqzDU-WE820h17blckC_CCsfRRx5YbGK89d3s0zc,1335 +virtualenv/activation/bash/__init__.py,sha256=R0droTEb9beTN_1gpFqmE6Hi2GO5NRAiXf_DVMooJDk,278 +virtualenv/activation/bash/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/bash/activate.sh,sha256=8NnbBA0VpoUEZzP09qO4Wp_3mfIq_j_7NXRGvJHBQq0,2179 +virtualenv/activation/batch/__init__.py,sha256=Op-Hm1OK7blQp5XKwPWLkOAWmKTdj7dDTuolIVMfmVE,679 +virtualenv/activation/batch/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/batch/activate.bat,sha256=l4zrCkLCIGP8epTUs_rP9yvjrpXLDcIRoQUP2dwjOTc,1019 +virtualenv/activation/batch/deactivate.bat,sha256=6OznnO-HC2wnWUN7YAT-bj815zeKMXEPC0keyBYwKUU,510 +virtualenv/activation/batch/pydoc.bat,sha256=pVuxn8mn9P_Rd0349fiBEiwIuMvfJQSfgJ2dljUT2fA,24 +virtualenv/activation/cshell/__init__.py,sha256=-IF_8zZah_Sk0KF3kJT6uMVdJw0eB3JNZOpQE2Icb44,312 +virtualenv/activation/cshell/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/cshell/activate.csh,sha256=wm_0n7o83RXSTUJsWc2PPV33Yh9Gad8AJQIuRvL6EYg,1471 +virtualenv/activation/fish/__init__.py,sha256=b2oUJ_4EvPsMwRrZBwtbdMNfWCugW1bgBMMYicSvUf4,217 +virtualenv/activation/fish/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/fish/activate.fish,sha256=FkJpM8png8v9Sk3yGNJCcGzUKAAMF1Hz0dYrskut0z0,3056 +virtualenv/activation/nushell/__init__.py,sha256=bTgmWArwtjjXAzEaqMrj7yMLFNMGaqm1CkpEhAdcQfQ,950 +virtualenv/activation/nushell/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/nushell/activate.nu,sha256=j2AUQoICNUhO1VxRMukUpciHhiw2zHomnBtE8MPgs1I,2583 +virtualenv/activation/nushell/deactivate.nu,sha256=KrUAqzyG6TTNMwJc7m6Ni0gbo-sLDU4C_AsGeBy4Hm4,682 +virtualenv/activation/powershell/__init__.py,sha256=LTRhEYt2PyJxJeG3qLz0RPkadR74KPWg6-9F-D3YlOc,228 +virtualenv/activation/powershell/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/powershell/activate.ps1,sha256=fitBG2YyeKTfkRn62CjocDb_PLjrgvi2FmpuBkFCcBw,1810 +virtualenv/activation/python/__init__.py,sha256=LDCB8CmXNjUd4gAta9eAcV_y_Y_KWyq1bvdygcU2zWE,1199 +virtualenv/activation/python/__pycache__/__init__.cpython-310.pyc,, +virtualenv/activation/python/__pycache__/activate_this.cpython-310.pyc,, +virtualenv/activation/python/activate_this.py,sha256=wUt6QVm-Rk94u-ENPn2wzKx0addx2orAe6tKQNcqzbw,1184 +virtualenv/activation/via_template.py,sha256=Sd3_TKmGUt-tmyPxPibuS3WHsWqsu7EmW3aQ3LHvtc0,2231 +virtualenv/app_data/__init__.py,sha256=ulnKcZXwOiGiLFnk6GwPvpV2sJYTDy1wwf1v5xDQCHg,1412 +virtualenv/app_data/__pycache__/__init__.cpython-310.pyc,, +virtualenv/app_data/__pycache__/base.cpython-310.pyc,, +virtualenv/app_data/__pycache__/na.cpython-310.pyc,, +virtualenv/app_data/__pycache__/read_only.cpython-310.pyc,, +virtualenv/app_data/__pycache__/via_disk_folder.cpython-310.pyc,, +virtualenv/app_data/__pycache__/via_tempdir.cpython-310.pyc,, +virtualenv/app_data/base.py,sha256=GSTFQnOqk3xHCdDMQXLF7GRzgmGQik2QkXOJVlI4iDQ,2077 +virtualenv/app_data/na.py,sha256=Dr3LHGOeKMblZKB6TP6kIsgkd4y5FQdM3t7Ag5zQlKk,1373 +virtualenv/app_data/read_only.py,sha256=J9yQQ6ZPQnyRf5kbXQaSY9C4mFKG4_tRpZ4-osj2BdU,1003 +virtualenv/app_data/via_disk_folder.py,sha256=34jW3TM7lXH4IYlPwlb6Tmadfd4UMVMQyGGlV5KC0fc,5419 +virtualenv/app_data/via_tempdir.py,sha256=wIlsQL72iIpseE05bzHlvR6piczol8GyIh5-3fhB6AQ,730 +virtualenv/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/config/__pycache__/__init__.cpython-310.pyc,, +virtualenv/config/__pycache__/convert.cpython-310.pyc,, +virtualenv/config/__pycache__/env_var.cpython-310.pyc,, +virtualenv/config/__pycache__/ini.cpython-310.pyc,, +virtualenv/config/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/config/cli/__pycache__/__init__.cpython-310.pyc,, +virtualenv/config/cli/__pycache__/parser.cpython-310.pyc,, +virtualenv/config/cli/parser.py,sha256=ofjXDw8GvOWGqxkH0d1ZBNnrIIMM7oAXcq2tAinrB5s,4457 +virtualenv/config/convert.py,sha256=YHT_thBGkiNYbt0ujzo-j1n4KjjBHM7R_y53Aqyo3j4,2614 +virtualenv/config/env_var.py,sha256=WscrnTyQv-76WcsX1rju9x1wUEwwi3FHPbmWsZtb_z8,680 +virtualenv/config/ini.py,sha256=vzJ5iqE2rqtu2Gf06DQN3mQdAZMW03Cg0lt7p_RFJ48,2490 +virtualenv/create/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/create/__pycache__/__init__.cpython-310.pyc,, +virtualenv/create/__pycache__/creator.cpython-310.pyc,, +virtualenv/create/__pycache__/debug.cpython-310.pyc,, +virtualenv/create/__pycache__/describe.cpython-310.pyc,, +virtualenv/create/__pycache__/pyenv_cfg.cpython-310.pyc,, +virtualenv/create/creator.py,sha256=NkEe1M7lhnO5Yd7PebHpjNPQgMDTN2k2TUyeOVLVpoM,8384 +virtualenv/create/debug.py,sha256=ETOke8w4Ib8fiufAHVeOkH3v0zrztljw3WjGvZyE0Mk,3342 +virtualenv/create/describe.py,sha256=7hxEeDYlC10sjMgluxPZrAjQuO0AuEvaSNa-rll3wlY,3344 +virtualenv/create/pyenv_cfg.py,sha256=3-dSAQ8sK86yqpAITWqXeKn2WbM9AyzBmR4HG9Tviqw,1600 +virtualenv/create/via_global_ref/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/create/via_global_ref/__pycache__/__init__.cpython-310.pyc,, +virtualenv/create/via_global_ref/__pycache__/_virtualenv.cpython-310.pyc,, +virtualenv/create/via_global_ref/__pycache__/api.cpython-310.pyc,, +virtualenv/create/via_global_ref/__pycache__/store.cpython-310.pyc,, +virtualenv/create/via_global_ref/__pycache__/venv.cpython-310.pyc,, +virtualenv/create/via_global_ref/_virtualenv.py,sha256=zlfV4Nm11zVstC2nRQuo-TWb32k-M19MkhYmlDx35k0,5626 +virtualenv/create/via_global_ref/api.py,sha256=8X59r2y3qdeeY6BScb3-Pe6Op1TVVrFWfv5ins4Gy_U,4128 +virtualenv/create/via_global_ref/builtin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/create/via_global_ref/builtin/__pycache__/__init__.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/__pycache__/builtin_way.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/__pycache__/ref.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/__pycache__/via_global_self_do.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/builtin_way.py,sha256=MIhEIVgieUmOyz35HXOlDNiuQ5y2yLlEjT7uBEBCV6w,493 +virtualenv/create/via_global_ref/builtin/cpython/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/create/via_global_ref/builtin/cpython/__pycache__/__init__.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/cpython/__pycache__/common.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/cpython/__pycache__/cpython2.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/cpython/__pycache__/cpython3.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/cpython/__pycache__/mac_os.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/cpython/common.py,sha256=Rb-S7ZJIzIT-M0VFZnBv_j1RN0ZBD10WwayJwRFppqw,2323 +virtualenv/create/via_global_ref/builtin/cpython/cpython2.py,sha256=R4riz776qT1oVw7GHMpntz2Tbi_rjyGUWQ3NXG-CCUs,3521 +virtualenv/create/via_global_ref/builtin/cpython/cpython3.py,sha256=ZKT0iHIh3_bS0w9_nZ0HsX5YeLn5sC2a76yj7cVHTyk,4612 +virtualenv/create/via_global_ref/builtin/cpython/mac_os.py,sha256=Qs5HffvEe_Yk1sQWMZFN_-X5YNUg7RsnQ-XQixFs8E8,14279 +virtualenv/create/via_global_ref/builtin/pypy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/create/via_global_ref/builtin/pypy/__pycache__/__init__.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/pypy/__pycache__/common.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/pypy/__pycache__/pypy2.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/pypy/__pycache__/pypy3.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/pypy/common.py,sha256=8awkppbB3qCdRh4P24lHkesPfNV6IVaZuahj_M177Bs,1733 +virtualenv/create/via_global_ref/builtin/pypy/pypy2.py,sha256=N8vuM7NvMuh2Njknc31ONptqcDPM_zIDSpgnEGPwZOk,3518 +virtualenv/create/via_global_ref/builtin/pypy/pypy3.py,sha256=2Iyxn9Q5QCKTL-SDKcwjzhZl1Hwd_XXB5LWVVnFxVsg,3106 +virtualenv/create/via_global_ref/builtin/python2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/create/via_global_ref/builtin/python2/__pycache__/__init__.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/python2/__pycache__/python2.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/python2/__pycache__/site.cpython-310.pyc,, +virtualenv/create/via_global_ref/builtin/python2/python2.py,sha256=DYEC3P-xFREo37x8p2H0FhhzgRfP0kk6WOgpFcY6EJc,4019 +virtualenv/create/via_global_ref/builtin/python2/site.py,sha256=4kiq0cs57rbrqtFBsl7MyyGB2G2zjWn-1CHuH8C7gPQ,6903 +virtualenv/create/via_global_ref/builtin/ref.py,sha256=s-Lqh-QGxmnMgnwicVtRJLRhXPhwGduCND7LIJAXCAM,5365 +virtualenv/create/via_global_ref/builtin/via_global_self_do.py,sha256=Eysi6ZSTpMN_5Y_rDnfMDytVmNHg2X2t3saEx18wRE8,4316 +virtualenv/create/via_global_ref/store.py,sha256=dgBBkTJGg5bdTtcFLIjze_RHZEOAOLrmgAMwRq3oPUE,614 +virtualenv/create/via_global_ref/venv.py,sha256=lh7AILmfV4b5uFJKeUbDNt8E1jkbZgvb4tulgw99TpI,3447 +virtualenv/discovery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/discovery/__pycache__/__init__.cpython-310.pyc,, +virtualenv/discovery/__pycache__/builtin.cpython-310.pyc,, +virtualenv/discovery/__pycache__/cached_py_info.cpython-310.pyc,, +virtualenv/discovery/__pycache__/discover.cpython-310.pyc,, +virtualenv/discovery/__pycache__/py_info.cpython-310.pyc,, +virtualenv/discovery/__pycache__/py_spec.cpython-310.pyc,, +virtualenv/discovery/builtin.py,sha256=7W8a-Z6hFrLJoJbsFDOsKYtgKzrVs3f0MWLu_yrp3_8,6138 +virtualenv/discovery/cached_py_info.py,sha256=I3Y-fJki0EHUbeySdWqMj7iyp060EbS4Gy85DEoerXs,6350 +virtualenv/discovery/discover.py,sha256=m1p-r-35bIt1UGU22V_g5URzNWakSPcxZ9iMyEQu8Jc,1137 +virtualenv/discovery/py_info.py,sha256=amfYYogKVcCoEfrB1Fnw7Xrq0ZWMSLBd0JLi74OqVy4,23906 +virtualenv/discovery/py_spec.py,sha256=ua6u59_1lPS29WUK2UOer74pJADwEzyXoJ6GHFspNk8,4514 +virtualenv/discovery/windows/__init__.py,sha256=Xb7-zapDH8BF9RPHRxMc87ZcV661jWOYl-UJGZV5Ltk,1251 +virtualenv/discovery/windows/__pycache__/__init__.cpython-310.pyc,, +virtualenv/discovery/windows/__pycache__/pep514.cpython-310.pyc,, +virtualenv/discovery/windows/pep514.py,sha256=EFmAj6_nQm1OAvLsCtwfy-upKm47oFXj6SA2r8kmM5Q,5059 +virtualenv/info.py,sha256=JU5yZ57YTzxBGnNlyn47chWyhJ4hESKdxiTI9yfNGkw,1796 +virtualenv/report.py,sha256=-8DUo7Aw1Ht08CjdC-cxhpQjv_fHzpTtVi9f6udlbzs,1321 +virtualenv/run/__init__.py,sha256=m-UlZUzX0kSvvABWMsFQg6kSADA8j5YtBniFiOvKshk,6004 +virtualenv/run/__pycache__/__init__.cpython-310.pyc,, +virtualenv/run/__pycache__/session.cpython-310.pyc,, +virtualenv/run/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/run/plugin/__pycache__/__init__.cpython-310.pyc,, +virtualenv/run/plugin/__pycache__/activators.cpython-310.pyc,, +virtualenv/run/plugin/__pycache__/base.cpython-310.pyc,, +virtualenv/run/plugin/__pycache__/creators.cpython-310.pyc,, +virtualenv/run/plugin/__pycache__/discovery.cpython-310.pyc,, +virtualenv/run/plugin/__pycache__/seeders.cpython-310.pyc,, +virtualenv/run/plugin/activators.py,sha256=MVwQ9s1VQviWcOvzjqfMDgKKDWFN_aYja2h_wmKfpcc,2169 +virtualenv/run/plugin/base.py,sha256=hTClgVLs5h96gPrPkvySSBsxKfECMj-eVXgkq9hQllE,2253 +virtualenv/run/plugin/creators.py,sha256=B_2lWKOMij7WrSBh225pxbxvfpnIeapT_k2C0HeNbMo,3369 +virtualenv/run/plugin/discovery.py,sha256=tbHIx6w7z5gWmhfxI4iYFpVx7jeQ8EwtODnKJxCc1d8,1167 +virtualenv/run/plugin/seeders.py,sha256=glln6lIH_ww23Tr9bzd1RLsG1Ro8pBKciwSBjTlVK2g,1006 +virtualenv/run/session.py,sha256=30zzQd8ofEt-PGkCmqiEXs3hFnrC-vHdbE5aMKjwl_o,2371 +virtualenv/seed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/seed/__pycache__/__init__.cpython-310.pyc,, +virtualenv/seed/__pycache__/seeder.cpython-310.pyc,, +virtualenv/seed/embed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/seed/embed/__pycache__/__init__.cpython-310.pyc,, +virtualenv/seed/embed/__pycache__/base_embed.cpython-310.pyc,, +virtualenv/seed/embed/__pycache__/pip_invoke.cpython-310.pyc,, +virtualenv/seed/embed/base_embed.py,sha256=upGWTCgPDGHC5ZVeN3RqH4ljhaYtvBgmWjQwlpHikPo,3802 +virtualenv/seed/embed/pip_invoke.py,sha256=Nv-jIPNUAiKC8cw9wjYoToWbC-aIJpCYayMvrdpmzcM,2095 +virtualenv/seed/embed/via_app_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/seed/embed/via_app_data/__pycache__/__init__.cpython-310.pyc,, +virtualenv/seed/embed/via_app_data/__pycache__/via_app_data.cpython-310.pyc,, +virtualenv/seed/embed/via_app_data/pip_install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/seed/embed/via_app_data/pip_install/__pycache__/__init__.cpython-310.pyc,, +virtualenv/seed/embed/via_app_data/pip_install/__pycache__/base.cpython-310.pyc,, +virtualenv/seed/embed/via_app_data/pip_install/__pycache__/copy.cpython-310.pyc,, +virtualenv/seed/embed/via_app_data/pip_install/__pycache__/symlink.cpython-310.pyc,, +virtualenv/seed/embed/via_app_data/pip_install/base.py,sha256=KDiFKhk8vVqZo35L-Y31UiCyddPUIpp7L9nXXGkiUDg,8062 +virtualenv/seed/embed/via_app_data/pip_install/copy.py,sha256=zAAKNWYjXu-NtNYVfobfvBOgj9VTCJK6oM85s_TfWSM,1190 +virtualenv/seed/embed/via_app_data/pip_install/symlink.py,sha256=panHf6OzF0XZTGEhroYwUPiFJukWEjY849fNtWTMqMA,2034 +virtualenv/seed/embed/via_app_data/via_app_data.py,sha256=K-fKit-lF6wjPdcu79DgLOTws4aYopoZhyRre9uz3HQ,5822 +virtualenv/seed/seeder.py,sha256=ZDTUelwoIUlJaxbb5-fMqAa-GLJdMN9E0H3Tb2w0xB8,1104 +virtualenv/seed/wheels/__init__.py,sha256=Deutdgs8-S1yYLjJ78AbNfpZqZF3TsJiFbvyBYF4kVo,168 +virtualenv/seed/wheels/__pycache__/__init__.cpython-310.pyc,, +virtualenv/seed/wheels/__pycache__/acquire.cpython-310.pyc,, +virtualenv/seed/wheels/__pycache__/bundle.cpython-310.pyc,, +virtualenv/seed/wheels/__pycache__/periodic_update.cpython-310.pyc,, +virtualenv/seed/wheels/__pycache__/util.cpython-310.pyc,, +virtualenv/seed/wheels/acquire.py,sha256=_XFqPnhXZZZNJbUAXDJjtFvjBo0lm1tmKeNmKBewkKo,4375 +virtualenv/seed/wheels/bundle.py,sha256=OjBgipHArMiz4ihvXSYcQ5p7K_GNbGVgq1fFjo5bdQA,1880 +virtualenv/seed/wheels/embed/__init__.py,sha256=QHU6TtZ5ma25BASlwF75MV83jps2rykdSKFvWZ49TG4,1898 +virtualenv/seed/wheels/embed/__pycache__/__init__.cpython-310.pyc,, +virtualenv/seed/wheels/embed/pip-20.3.4-py2.py3-none-any.whl,sha256=IXrlFhoOCMD7hzhYgG40eMl3XK_85RaLUOyIXjWMGZ0,1522101 +virtualenv/seed/wheels/embed/pip-21.3.1-py3-none-any.whl,sha256=3q8y3Nmrgh41nNgzB4a80HdgS1xXMMCwlu2kb5XCSi0,1723581 +virtualenv/seed/wheels/embed/pip-22.2.1-py3-none-any.whl,sha256=C7vIffvm7tIXvv8AIfi33qBMj0oLqp0x3Ez_KB_8Wys,2044666 +virtualenv/seed/wheels/embed/setuptools-44.1.1-py2.py3-none-any.whl,sha256=J6cUwJJTE05gpvpoEw94xwN-VWLE8h-PMY8q6QDRUtU,583493 +virtualenv/seed/wheels/embed/setuptools-50.3.2-py3-none-any.whl,sha256=LCQqCFb7rX775WDfSnrdkyTzQM9I30NlHpYEkkRmeUo,785194 +virtualenv/seed/wheels/embed/setuptools-59.6.0-py3-none-any.whl,sha256=TOkvHh-PASM-6ZUsBPa4HR4Ck51uG0iEKBVJdKTQeD4,952597 +virtualenv/seed/wheels/embed/setuptools-63.2.0-py3-none-any.whl,sha256=DTPDdNQceGNBn8j2wQv-Jbe0mKo0Fk0TXGIuUlgMaxY,1228000 +virtualenv/seed/wheels/embed/wheel-0.37.1-py2.py3-none-any.whl,sha256=S9zX2EATgIYSbNCSVNxhlftPxvAcBQodcjbyYw2x0io,35301 +virtualenv/seed/wheels/periodic_update.py,sha256=xGX7dElg0dz86M10rjUCp9b3ln9d7hJTewsa16H5tCE,14827 +virtualenv/seed/wheels/util.py,sha256=ixjwODR81FYc4dOZu1LDRYo--ejzcq5XYM-EVDdDPjg,3844 +virtualenv/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +virtualenv/util/__pycache__/__init__.cpython-310.pyc,, +virtualenv/util/__pycache__/error.cpython-310.pyc,, +virtualenv/util/__pycache__/lock.cpython-310.pyc,, +virtualenv/util/__pycache__/zipapp.cpython-310.pyc,, +virtualenv/util/error.py,sha256=fqLMXou_tzEk_Bp_thd4lknIpxwde1r9BPvg4eZBUzM,272 +virtualenv/util/lock.py,sha256=KIFBVOI1vMRkLYAuIIK5wcPLAfXB8fYNlb2ah1C-jfs,4558 +virtualenv/util/path/__init__.py,sha256=SJqnTNAQE41RveIMRQHKjlJ-uyNEzjbavJa5jNZl6MA,304 +virtualenv/util/path/__pycache__/__init__.cpython-310.pyc,, +virtualenv/util/path/__pycache__/_permission.cpython-310.pyc,, +virtualenv/util/path/__pycache__/_sync.cpython-310.pyc,, +virtualenv/util/path/__pycache__/_win.cpython-310.pyc,, +virtualenv/util/path/_permission.py,sha256=8fonBjbUY3n9_XJFf5IXTOeH6jsZCwwUNb4nOwEWX5s,629 +virtualenv/util/path/_sync.py,sha256=YKWmJG-SH8TXIDlD6VuihwhTnrhHTOPGSgMcipSOx8E,1910 +virtualenv/util/path/_win.py,sha256=u6vk48jO6HX-eNfl1HKuxwybMGGs4hg9BXWkKA19iTo,752 +virtualenv/util/subprocess/__init__.py,sha256=_KtQsx0AJZjGttuODKCBe2X2troxYXo5KA0L58-kWwE,652 +virtualenv/util/subprocess/__pycache__/__init__.cpython-310.pyc,, +virtualenv/util/zipapp.py,sha256=oEqNNmf_lROPQZGI3wltUaKksBykldF1TdyFEyOUBVo,982 +virtualenv/version.py,sha256=s1o6qTBgLVuQB5nGA0UhNT7d776s4ro37Um7tnp4fps,66 diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/REQUESTED b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/REQUESTED similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/REQUESTED rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/REQUESTED diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/WHEEL b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/WHEEL similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/WHEEL rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/WHEEL diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/entry_points.txt b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/entry_points.txt similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/entry_points.txt rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/entry_points.txt diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/top_level.txt b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/top_level.txt similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/top_level.txt rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/top_level.txt diff --git a/src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/zip-safe b/src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/zip-safe similarity index 100% rename from src/main/python/pybuilder/_vendor/virtualenv-20.14.1.dist-info/zip-safe rename to src/main/python/pybuilder/_vendor/virtualenv-20.16.2.dist-info/zip-safe diff --git a/src/main/python/pybuilder/_vendor/virtualenv/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/__init__.py index 5f74e3ef2..e40e8b7c4 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/__init__.py @@ -1,10 +1,8 @@ -from __future__ import absolute_import, unicode_literals - from .run import cli_run, session_via_cli from .version import __version__ -__all__ = ( +__all__ = [ "__version__", "cli_run", "session_via_cli", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/__main__.py b/src/main/python/pybuilder/_vendor/virtualenv/__main__.py index 4b4e0c6aa..d04800ae7 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/__main__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/__main__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, unicode_literals - import logging import os import sys @@ -18,41 +16,32 @@ def run(args=None, options=None, env=None): session = cli_run(args, options, env) logging.warning(LogSession(session, start)) except ProcessCallFailed as exception: - print("subprocess call failed for {} with code {}".format(exception.cmd, exception.code)) + print(f"subprocess call failed for {exception.cmd} with code {exception.code}") print(exception.out, file=sys.stdout, end="") print(exception.err, file=sys.stderr, end="") raise SystemExit(exception.code) -class LogSession(object): +class LogSession: def __init__(self, session, start): self.session = session self.start = start def __str__(self): - from .util.six import ensure_text - spec = self.session.creator.interpreter.spec elapsed = (datetime.now() - self.start).total_seconds() * 1000 lines = [ - "created virtual environment {} in {:.0f}ms".format(spec, elapsed), - " creator {}".format(ensure_text(str(self.session.creator))), + f"created virtual environment {spec} in {elapsed:.0f}ms", + f" creator {str(self.session.creator)}", ] if self.session.seeder.enabled: - lines += ( - " seeder {}".format(ensure_text(str(self.session.seeder))), - " added seed packages: {}".format( - ", ".join( - sorted( - "==".join(i.stem.split("-")) - for i in self.session.creator.purelib.iterdir() - if i.suffix == ".dist-info" - ), - ), - ), - ) + lines.append(f" seeder {str(self.session.seeder)}") + path = self.session.creator.purelib.iterdir() + packages = sorted("==".join(i.stem.split("-")) for i in path if i.suffix == ".dist-info") + lines.append(f" added seed packages: {', '.join(packages)}") + if self.session.activators: - lines.append(" activators {}".format(",".join(i.__class__.__name__ for i in self.session.activators))) + lines.append(f" activators {','.join(i.__class__.__name__ for i in self.session.activators)}") return "\n".join(lines) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/__init__.py index e9296d86e..99984bc54 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/__init__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - from .bash import BashActivator from .batch import BatchActivator from .cshell import CShellActivator diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/activator.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/activator.py index 284aa9c6d..ad9d9e020 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/activator.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/activator.py @@ -1,14 +1,9 @@ -from __future__ import absolute_import, unicode_literals - import os from abc import ABCMeta, abstractmethod -from ...six import add_metaclass - -@add_metaclass(ABCMeta) -class Activator(object): - """Generates an activate script for the virtual environment""" +class Activator(metaclass=ABCMeta): + """Generates activate script for the virtual environment""" def __init__(self, options): """Create a new activator generator. @@ -37,9 +32,14 @@ def add_parser_arguments(cls, parser, interpreter): @abstractmethod def generate(self, creator): - """Generate the activate script for the given creator. + """Generate activate script for the given creator. :param creator: the creator (based of :class:`virtualenv.create.creator.Creator`) we used to create this \ virtual environment """ raise NotImplementedError + + +__all__ = [ + "Activator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/bash/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/bash/__init__.py index b83e44964..e704126cf 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/bash/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/bash/__init__.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import, unicode_literals - -from ...util.path import Path +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -11,3 +9,8 @@ def templates(self): def as_name(self, template): return template.stem + + +__all__ = [ + "BashActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/batch/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/batch/__init__.py index 71720a726..6c35337fc 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/batch/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/batch/__init__.py @@ -1,8 +1,5 @@ -from __future__ import absolute_import, unicode_literals - import os - -from ...util.path import Path +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -19,5 +16,10 @@ def templates(self): def instantiate_template(self, replacements, template, creator): # ensure the text has all newlines as \r\n - required by batch - base = super(BatchActivator, self).instantiate_template(replacements, template, creator) + base = super().instantiate_template(replacements, template, creator) return base.replace(os.linesep, "\n").replace("\n", os.linesep) + + +__all__ = [ + "BatchActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/cshell/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/cshell/__init__.py index 23165134d..b225ba31f 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/cshell/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/cshell/__init__.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import, unicode_literals - -from ...util.path import Path +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -12,3 +10,8 @@ def supports(cls, interpreter): def templates(self): yield Path("activate.csh") + + +__all__ = [ + "CShellActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/fish/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/fish/__init__.py index e20c35827..4b240421a 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/fish/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/fish/__init__.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import, unicode_literals - -from ...util.path import Path +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -8,3 +6,8 @@ class FishActivator(ViaTemplateActivator): def templates(self): yield Path("activate.fish") + + +__all__ = [ + "FishActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/__init__.py index 8146023a1..839c19c26 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/__init__.py @@ -1,9 +1,5 @@ -from __future__ import absolute_import, unicode_literals - import os - -from ...util.path import Path -from ...util.six import ensure_text +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -20,9 +16,14 @@ def replacements(self, creator, dest_folder): return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, - "__VIRTUAL_ENV__": ensure_text(str(creator.dest)), + "__VIRTUAL_ENV__": str(creator.dest), "__VIRTUAL_NAME__": creator.env_name, - "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), - "__PATH_SEP__": ensure_text(os.pathsep), - "__DEACTIVATE_PATH__": ensure_text(str(Path(dest_folder) / "deactivate.nu")), + "__BIN_NAME__": str(creator.bin_dir.relative_to(creator.dest)), + "__PATH_SEP__": os.pathsep, + "__DEACTIVATE_PATH__": str(Path(dest_folder) / "deactivate.nu"), } + + +__all__ = [ + "NushellActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/activate.nu b/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/activate.nu index ffeff7d45..48c85b488 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/activate.nu +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/activate.nu @@ -8,11 +8,11 @@ def-env activate-virtualenv [] { $name in (env).name } - let is-windows = ((sys).host.name | str downcase) == 'windows' - let virtual-env = '__VIRTUAL_ENV__' + let is_windows = ((sys).host.name | str downcase) == 'windows' + let virtual_env = '__VIRTUAL_ENV__' let bin = '__BIN_NAME__' - let path-sep = '__PATH_SEP__' - let path-name = if $is-windows { + let path_sep = '__PATH_SEP__' + let path_name = if $is_windows { if (has-env 'Path') { 'Path' } else { @@ -22,8 +22,8 @@ def-env activate-virtualenv [] { 'PATH' } - let old-path = ( - if $is-windows { + let old_path = ( + if $is_windows { if (has-env 'Path') { $env.Path } else { @@ -33,24 +33,24 @@ def-env activate-virtualenv [] { $env.PATH } | if (is-string $in) { # if Path/PATH is a string, make it a list - $in | split row $path-sep | path expand + $in | split row $path_sep | path expand } else { $in } ) - let venv-path = ([$virtual-env $bin] | path join) - let new-path = ($old-path | prepend $venv-path | str collect $path-sep) + let venv_path = ([$virtual_env $bin] | path join) + let new_path = ($old_path | prepend $venv_path | str collect $path_sep) # Creating the new prompt for the session - let virtual-prompt = if ('__VIRTUAL_PROMPT__' == '') { - $'(char lparen)($virtual-env | path basename)(char rparen) ' + let virtual_prompt = if ('__VIRTUAL_PROMPT__' == '') { + $'(char lparen)($virtual_env | path basename)(char rparen) ' } else { '(__VIRTUAL_PROMPT__) ' } # Back up the old prompt builder - let old-prompt-command = if (has-env 'VIRTUAL_ENV') && (has-env '_OLD_PROMPT_COMMAND') { + let old_prompt_command = if (has-env 'VIRTUAL_ENV') && (has-env '_OLD_PROMPT_COMMAND') { $env._OLD_PROMPT_COMMAND } else { if (has-env 'PROMPT_COMMAND') { @@ -61,28 +61,28 @@ def-env activate-virtualenv [] { } # If there is no default prompt, then only the env is printed in the prompt - let new-prompt = if (has-env 'PROMPT_COMMAND') { - if ($old-prompt-command | describe) == 'block' { - { $'($virtual-prompt)(do $old-prompt-command)' } + let new_prompt = if (has-env 'PROMPT_COMMAND') { + if ($old_prompt_command | describe) == 'block' { + { $'($virtual_prompt)(do $old_prompt_command)' } } else { - { $'($virtual-prompt)($old-prompt-command)' } + { $'($virtual_prompt)($old_prompt_command)' } } } else { - { $'($virtual-prompt)' } + { $'($virtual_prompt)' } } # Environment variables that will be batched loaded to the virtual env - let new-env = { - $path-name : $new-path - VIRTUAL_ENV : $virtual-env - _OLD_VIRTUAL_PATH : ($old-path | str collect $path-sep) - _OLD_PROMPT_COMMAND : $old-prompt-command - PROMPT_COMMAND : $new-prompt - VIRTUAL_PROMPT : $virtual-prompt + let new_env = { + $path_name : $new_path + VIRTUAL_ENV : $virtual_env + _OLD_VIRTUAL_PATH : ($old_path | str collect $path_sep) + _OLD_PROMPT_COMMAND : $old_prompt_command + PROMPT_COMMAND : $new_prompt + VIRTUAL_PROMPT : $virtual_prompt } # Activate the environment variables - load-env $new-env + load-env $new_env } # Activate the virtualenv diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/deactivate.nu b/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/deactivate.nu index 904f7d0e8..4dd132c34 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/deactivate.nu +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/deactivate.nu @@ -3,9 +3,9 @@ def-env deactivate-virtualenv [] { $name in (env).name } - let is-windows = ((sys).host.name | str downcase) == 'windows' + let is_windows = ((sys).host.name | str downcase) == 'windows' - let path-name = if $is-windows { + let path_name = if $is_windows { if (has-env 'Path') { 'Path' } else { @@ -15,7 +15,7 @@ def-env deactivate-virtualenv [] { 'PATH' } - load-env { $path-name : $env._OLD_VIRTUAL_PATH } + load-env { $path_name : $env._OLD_VIRTUAL_PATH } let-env PROMPT_COMMAND = $env._OLD_PROMPT_COMMAND diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/powershell/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/powershell/__init__.py index 54ed58e0b..6d561bf7f 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/powershell/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/powershell/__init__.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import, unicode_literals - -from ...util.path import Path +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -8,3 +6,8 @@ class PowerShellActivator(ViaTemplateActivator): def templates(self): yield Path("activate.ps1") + + +__all__ = [ + "PowerShellActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/python/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/python/__init__.py index 32ea2b930..ad3820172 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/python/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/python/__init__.py @@ -1,11 +1,7 @@ -from __future__ import absolute_import, unicode_literals - import os import sys from collections import OrderedDict - -from ...util.path import Path -from ...util.six import ensure_text +from pathlib import Path from ..via_template import ViaTemplateActivator @@ -15,12 +11,12 @@ def templates(self): yield Path("activate_this.py") def replacements(self, creator, dest_folder): - replacements = super(PythonActivator, self).replacements(creator, dest_folder) + replacements = super().replacements(creator, dest_folder) lib_folders = OrderedDict((os.path.relpath(str(i), str(dest_folder)), None) for i in creator.libs) win_py2 = creator.interpreter.platform == "win32" and creator.interpreter.version_info.major == 2 replacements.update( { - "__LIB_FOLDERS__": ensure_text(os.pathsep.join(lib_folders.keys())), + "__LIB_FOLDERS__": os.pathsep.join(lib_folders.keys()), "__DECODE_PATH__": ("yes" if win_py2 else ""), }, ) @@ -31,5 +27,10 @@ def _repr_unicode(creator, value): py2 = creator.interpreter.version_info.major == 2 if py2: # on Python 2 we need to encode this into explicit utf-8, py3 supports unicode literals start = 2 if sys.version_info[0] == 3 else 1 - value = ensure_text(repr(value.encode("utf-8"))[start:-1]) + value = repr(value.encode("utf-8"))[start:-1] return value + + +__all__ = [ + "PythonActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/python/activate_this.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/python/activate_this.py index 29debe3e7..e8eeb843f 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/python/activate_this.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/python/activate_this.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Activate virtualenv for current interpreter: Use exec(open(this_file).read(), {'__file__': this_file}). diff --git a/src/main/python/pybuilder/_vendor/virtualenv/activation/via_template.py b/src/main/python/pybuilder/_vendor/virtualenv/activation/via_template.py index 7a9e5c826..13f4a0f46 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/activation/via_template.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/activation/via_template.py @@ -1,13 +1,7 @@ -from __future__ import absolute_import, unicode_literals - import os import sys from abc import ABCMeta, abstractmethod -from ...six import add_metaclass - -from ..util.six import ensure_text - from .activator import Activator if sys.version_info >= (3, 7): @@ -16,8 +10,7 @@ from ...importlib_resources import read_binary -@add_metaclass(ABCMeta) -class ViaTemplateActivator(Activator): +class ViaTemplateActivator(Activator, metaclass=ABCMeta): @abstractmethod def templates(self): raise NotImplementedError @@ -33,10 +26,10 @@ def generate(self, creator): def replacements(self, creator, dest_folder): return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, - "__VIRTUAL_ENV__": ensure_text(str(creator.dest)), + "__VIRTUAL_ENV__": str(creator.dest), "__VIRTUAL_NAME__": creator.env_name, - "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), - "__PATH_SEP__": ensure_text(os.pathsep), + "__BIN_NAME__": str(creator.bin_dir.relative_to(creator.dest)), + "__PATH_SEP__": os.pathsep, } def _generate(self, replacements, templates, to_folder, creator): @@ -63,5 +56,9 @@ def instantiate_template(self, replacements, template, creator): @staticmethod def _repr_unicode(creator, value): - # by default we just let it be unicode - return value + return value # by default we just let it be unicode + + +__all__ = [ + "ViaTemplateActivator", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/app_data/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/app_data/__init__.py index e56e63d53..262ac0782 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/app_data/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/app_data/__init__.py @@ -1,7 +1,6 @@ """ Application data stored by virtualenv. """ -from __future__ import absolute_import, unicode_literals import logging import os @@ -15,7 +14,7 @@ def _default_app_data_dir(env): - key = str("VIRTUALENV_OVERRIDE_APP_DATA") + key = "VIRTUALENV_OVERRIDE_APP_DATA" if key in env: return env[key] else: @@ -23,7 +22,7 @@ def _default_app_data_dir(env): def make_app_data(folder, **kwargs): - read_only = kwargs.pop("read_only") + is_read_only = kwargs.pop("read_only") env = kwargs.pop("env") if kwargs: # py3+ kwonly raise TypeError("unexpected keywords: {}") @@ -32,7 +31,7 @@ def make_app_data(folder, **kwargs): folder = _default_app_data_dir(env) folder = os.path.abspath(folder) - if read_only: + if is_read_only: return ReadOnlyAppData(folder) if not os.path.isdir(folder): diff --git a/src/main/python/pybuilder/_vendor/virtualenv/app_data/base.py b/src/main/python/pybuilder/_vendor/virtualenv/app_data/base.py index 9ae2778cc..bc5e5167d 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/app_data/base.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/app_data/base.py @@ -1,18 +1,14 @@ """ Application data stored by virtualenv. """ -from __future__ import absolute_import, unicode_literals from abc import ABCMeta, abstractmethod from contextlib import contextmanager -from ... import six - from ..info import IS_ZIPAPP -@six.add_metaclass(ABCMeta) -class AppData(object): +class AppData(metaclass=ABCMeta): """Abstract storage interface for the virtualenv application""" @abstractmethod @@ -71,8 +67,7 @@ def locked(self, path): raise NotImplementedError -@six.add_metaclass(ABCMeta) -class ContentStore(object): +class ContentStore(metaclass=ABCMeta): @abstractmethod def exists(self): raise NotImplementedError @@ -93,3 +88,9 @@ def remove(self): @contextmanager def locked(self): pass + + +__all__ = [ + "ContentStore", + "AppData", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/app_data/na.py b/src/main/python/pybuilder/_vendor/virtualenv/app_data/na.py index d5897871f..da45f58e8 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/app_data/na.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/app_data/na.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - from contextlib import contextmanager from .base import AppData, ContentStore @@ -44,7 +42,7 @@ def wheel_image(self, for_py_version, name): raise self.error def py_info_clear(self): - """ """ + """nothing to clear""" class ContentStoreNA(ContentStore): @@ -52,15 +50,21 @@ def exists(self): return False def read(self): - """ """ + """nothing to read""" return None def write(self, content): - """ """ + """nothing to write""" def remove(self): - """ """ + """nothing to remove""" @contextmanager def locked(self): yield + + +__all__ = [ + "AppDataDisabled", + "ContentStoreNA", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/app_data/read_only.py b/src/main/python/pybuilder/_vendor/virtualenv/app_data/read_only.py index 35373fb7f..bda9c8442 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/app_data/read_only.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/app_data/read_only.py @@ -8,15 +8,16 @@ class ReadOnlyAppData(AppDataDiskFolder): can_update = False - def __init__(self, folder): # type: (str) -> None + def __init__(self, folder: str) -> None: if not os.path.isdir(folder): - raise RuntimeError("read-only app data directory {} does not exist".format(folder)) + raise RuntimeError(f"read-only app data directory {folder} does not exist") + super().__init__(folder) self.lock = NoOpFileLock(folder) - def reset(self): # type: () -> None + def reset(self) -> None: raise RuntimeError("read-only app data does not support reset") - def py_info_clear(self): # type: () -> None + def py_info_clear(self) -> None: raise NotImplementedError def py_info(self, path): @@ -31,4 +32,6 @@ def write(self, content): raise RuntimeError("read-only app data python info cannot be updated") -__all__ = ("ReadOnlyAppData",) +__all__ = [ + "ReadOnlyAppData", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_disk_folder.py b/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_disk_folder.py index 3f44fe4f6..c4ae52338 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_disk_folder.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_disk_folder.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- """ A rough layout of the current storage goes as: virtualenv-app-data ├── py - -│   └── *.json/lock +│ └── *.json/lock ├── wheel -│   ├── house +│ ├── house │ │ └── *.whl │ └── -> 3.9 │ ├── img- @@ -22,7 +21,6 @@ ├── debug.py └── _virtualenv.py """ -from __future__ import absolute_import, unicode_literals import json import logging @@ -30,11 +28,8 @@ from contextlib import contextmanager from hashlib import sha256 -from ... import six - from ..util.lock import ReentrantFileLock from ..util.path import safe_delete -from ..util.six import ensure_text from ..util.zipapp import extract from ..version import __version__ @@ -53,7 +48,7 @@ def __init__(self, folder): self.lock = ReentrantFileLock(folder) def __repr__(self): - return "{}({})".format(type(self).__name__, self.lock.path) + return f"{type(self).__name__}({self.lock.path})" def __str__(self): return str(self.lock.path) @@ -113,8 +108,7 @@ def wheel_image(self, for_py_version, name): return self.lock.path / "wheel" / for_py_version / "image" / "1" / name -@six.add_metaclass(ABCMeta) -class JSONStoreDisk(ContentStore): +class JSONStoreDisk(ContentStore, metaclass=ABCMeta): def __init__(self, in_folder, key, msg, msg_args): self.in_folder = in_folder self.key = key @@ -123,7 +117,7 @@ def __init__(self, in_folder, key, msg, msg_args): @property def file(self): - return self.in_folder.path / "{}.json".format(self.key) + return self.in_folder.path / f"{self.key}.json" def exists(self): return self.file.exists() @@ -132,7 +126,7 @@ def read(self): data, bad_format = None, False try: data = json.loads(self.file.read_text()) - logging.debug("got {} from %s".format(self.msg), *self.msg_args) + logging.debug(f"got {self.msg} from %s", *self.msg_args) return data except ValueError: bad_format = True @@ -147,7 +141,7 @@ def read(self): def remove(self): self.file.unlink() - logging.debug("removed {} at %s".format(self.msg), *self.msg_args) + logging.debug(f"removed {self.msg} at %s", *self.msg_args) @contextmanager def locked(self): @@ -157,21 +151,28 @@ def locked(self): def write(self, content): folder = self.file.parent folder.mkdir(parents=True, exist_ok=True) - self.file.write_text(ensure_text(json.dumps(content, sort_keys=True, indent=2))) - logging.debug("wrote {} at %s".format(self.msg), *self.msg_args) + self.file.write_text(json.dumps(content, sort_keys=True, indent=2)) + logging.debug(f"wrote {self.msg} at %s", *self.msg_args) class PyInfoStoreDisk(JSONStoreDisk): def __init__(self, in_folder, path): - key = sha256(str(path).encode("utf-8") if six.PY3 else str(path)).hexdigest() - super(PyInfoStoreDisk, self).__init__(in_folder, key, "python info of %s", (path,)) + key = sha256(str(path).encode("utf-8")).hexdigest() + super().__init__(in_folder, key, "python info of %s", (path,)) class EmbedDistributionUpdateStoreDisk(JSONStoreDisk): def __init__(self, in_folder, distribution): - super(EmbedDistributionUpdateStoreDisk, self).__init__( + super().__init__( in_folder, distribution, "embed update of distribution %s", (distribution,), ) + + +__all__ = [ + "AppDataDiskFolder", + "JSONStoreDisk", + "PyInfoStoreDisk", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_tempdir.py b/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_tempdir.py index 31166ba48..f9afb57d9 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_tempdir.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/app_data/via_tempdir.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import logging from tempfile import mkdtemp @@ -13,7 +11,7 @@ class TempAppData(AppDataDiskFolder): can_update = False def __init__(self): - super(TempAppData, self).__init__(folder=mkdtemp()) + super().__init__(folder=mkdtemp()) logging.debug("created temporary app data folder %s", self.lock.path) def reset(self): @@ -25,3 +23,8 @@ def close(self): def embed_update_log(self, distribution, for_py_version): raise NotImplementedError + + +__all__ = [ + "TempAppData", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/config/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/config/__init__.py index 01e6d4f49..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/config/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/config/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, unicode_literals diff --git a/src/main/python/pybuilder/_vendor/virtualenv/config/cli/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/config/cli/__init__.py index 01e6d4f49..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/config/cli/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/config/cli/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, unicode_literals diff --git a/src/main/python/pybuilder/_vendor/virtualenv/config/cli/parser.py b/src/main/python/pybuilder/_vendor/virtualenv/config/cli/parser.py index 812d44a25..01e13bd54 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/config/cli/parser.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/config/cli/parser.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import os from argparse import SUPPRESS, ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace from collections import OrderedDict @@ -12,7 +10,7 @@ class VirtualEnvOptions(Namespace): def __init__(self, **kwargs): - super(VirtualEnvOptions, self).__init__(**kwargs) + super().__init__(**kwargs) self._src = None self._sources = {} @@ -25,7 +23,7 @@ def set_src(self, key, value, src): def __setattr__(self, key, value): if getattr(self, "_src", None) is not None: self._sources[key] = self._src - super(VirtualEnvOptions, self).__setattr__(key, value) + super().__setattr__(key, value) def get_source(self, key): return self._sources.get(key) @@ -37,10 +35,7 @@ def verbosity(self): return max(self.verbose - self.quiet, 0) def __repr__(self): - return "{}({})".format( - type(self).__name__, - ", ".join("{}={}".format(k, v) for k, v in vars(self).items() if not k.startswith("_")), - ) + return f"{type(self).__name__}({', '.join(f'{k}={v}' for k, v in vars(self).items() if not k.startswith('_'))})" class VirtualEnvConfigParser(ArgumentParser): @@ -57,7 +52,7 @@ def __init__(self, options=None, env=None, *args, **kwargs): kwargs["add_help"] = False kwargs["formatter_class"] = HelpFormatter kwargs["prog"] = "virtualenv" - super(VirtualEnvConfigParser, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._fixed = set() if options is not None and not isinstance(options, VirtualEnvOptions): raise TypeError("options must be of type VirtualEnvOptions") @@ -105,20 +100,27 @@ def parse_known_args(self, args=None, namespace=None): self.options._src = "cli" try: namespace.env = self.env - return super(VirtualEnvConfigParser, self).parse_known_args(args, namespace=namespace) + return super().parse_known_args(args, namespace=namespace) finally: self.options._src = None class HelpFormatter(ArgumentDefaultsHelpFormatter): def __init__(self, prog): - super(HelpFormatter, self).__init__(prog, max_help_position=32, width=240) + super().__init__(prog, max_help_position=32, width=240) def _get_help_string(self, action): - # noinspection PyProtectedMember - text = super(HelpFormatter, self)._get_help_string(action) + + text = super()._get_help_string(action) if hasattr(action, "default_source"): default = " (default: %(default)s)" if text.endswith(default): - text = "{} (default: %(default)s -> from %(default_source)s)".format(text[: -len(default)]) + text = f"{text[: -len(default)]} (default: %(default)s -> from %(default_source)s)" return text + + +__all__ = [ + "HelpFormatter", + "VirtualEnvConfigParser", + "VirtualEnvOptions", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/config/convert.py b/src/main/python/pybuilder/_vendor/virtualenv/config/convert.py index df408663d..52f722e65 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/config/convert.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/config/convert.py @@ -1,16 +1,14 @@ -from __future__ import absolute_import, unicode_literals - import logging import os -class TypeData(object): +class TypeData: def __init__(self, default_type, as_type): self.default_type = default_type self.as_type = as_type def __repr__(self): - return "{}(base={}, as={})".format(self.__class__.__name__, self.default_type, self.as_type) + return f"{self.__class__.__name__}(base={self.default_type}, as={self.as_type})" def convert(self, value): return self.default_type(value) @@ -30,7 +28,7 @@ class BoolType(TypeData): def convert(self, value): if value.lower() not in self.BOOLEAN_STATES: - raise ValueError("Not a boolean: %s" % value) + raise ValueError(f"Not a boolean: {value}") return self.BOOLEAN_STATES[value.lower()] @@ -92,7 +90,7 @@ def get_type(action): return _CONVERT.get(default_type, TypeData)(default_type, as_type) -__all__ = ( +__all__ = [ "convert", "get_type", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/config/env_var.py b/src/main/python/pybuilder/_vendor/virtualenv/config/env_var.py index 1b33749d4..5dc0c1ded 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/config/env_var.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/config/env_var.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import, unicode_literals - -from ..util.six import ensure_str, ensure_text - from .convert import convert @@ -13,16 +9,18 @@ def get_env_var(key, as_type, env): :param env: environment variables to use :return: """ - environ_key = ensure_str("VIRTUALENV_{}".format(key.upper())) + environ_key = f"VIRTUALENV_{key.upper()}" if env.get(environ_key): value = env[environ_key] - # noinspection PyBroadException + try: - source = "env var {}".format(ensure_text(environ_key)) + source = f"env var {environ_key}" as_type = convert(value, as_type, source) return as_type, source except Exception: # note the converter already logs a warning when failures happen pass -__all__ = ("get_env_var",) +__all__ = [ + "get_env_var", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/config/ini.py b/src/main/python/pybuilder/_vendor/virtualenv/config/ini.py index 27bb91fba..50da8844d 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/config/ini.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/config/ini.py @@ -1,20 +1,15 @@ -from __future__ import absolute_import, unicode_literals - import logging import os +from configparser import ConfigParser +from pathlib import Path from platformdirs import user_config_dir -from ..info import PY3 -from ..util import ConfigParser -from ..util.path import Path -from ..util.six import ensure_str - from .convert import convert -class IniConfig(object): - VIRTUALENV_CONFIG_FILE_ENV_VAR = ensure_str("VIRTUALENV_CONFIG_FILE") +class IniConfig: + VIRTUALENV_CONFIG_FILE_ENV_VAR = "VIRTUALENV_CONFIG_FILE" STATE = {None: "failed to parse", True: "active", False: "missing"} section = "virtualenv" @@ -23,11 +18,10 @@ def __init__(self, env=None): env = os.environ if env is None else env config_file = env.get(self.VIRTUALENV_CONFIG_FILE_ENV_VAR, None) self.is_env_var = config_file is not None - config_file = ( - Path(config_file) - if config_file is not None - else Path(user_config_dir(appname="virtualenv", appauthor="pypa")) / "virtualenv.ini" - ) + if config_file is None: + config_file = Path(user_config_dir(appname="virtualenv", appauthor="pypa")) / "virtualenv.ini" + else: + config_file = Path(config_file) self.config_file = config_file self._cache = {} @@ -40,7 +34,7 @@ def __init__(self, env=None): else: if self.has_config_file: self.config_file = self.config_file.resolve() - self.config_parser = ConfigParser.ConfigParser() + self.config_parser = ConfigParser() try: self._load() self.has_virtualenv_section = self.config_parser.has_section(self.section) @@ -51,14 +45,12 @@ def __init__(self, env=None): def _load(self): with self.config_file.open("rt") as file_handler: - reader = getattr(self.config_parser, "read_file" if PY3 else "readfp") - reader(file_handler) + return self.config_parser.read_file(file_handler) def get(self, key, as_type): cache_key = key, as_type if cache_key in self._cache: return self._cache[cache_key] - # noinspection PyBroadException try: source = "file" raw_value = self.config_parser.get(self.section, key.lower()) @@ -74,11 +66,7 @@ def __bool__(self): @property def epilog(self): - msg = "{}config file {} {} (change{} via env var {})" - return msg.format( - "\n", - self.config_file, - self.STATE[self.has_config_file], - "d" if self.is_env_var else "", - self.VIRTUALENV_CONFIG_FILE_ENV_VAR, + return ( + f"\nconfig file {self.config_file} {self.STATE[self.has_config_file]} " + f"(change{'d' if self.is_env_var else ''} via env var {self.VIRTUALENV_CONFIG_FILE_ENV_VAR})" ) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/create/__init__.py index 01e6d4f49..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, unicode_literals diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/creator.py b/src/main/python/pybuilder/_vendor/virtualenv/create/creator.py index 4f34febb9..7fa1a0f4b 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/creator.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/creator.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, unicode_literals - import json import logging import os @@ -8,14 +6,10 @@ from argparse import ArgumentTypeError from ast import literal_eval from collections import OrderedDict -from textwrap import dedent - -from ...six import add_metaclass +from pathlib import Path from ..discovery.cached_py_info import LogCmd -from ..info import WIN_CPYTHON_2 -from ..util.path import Path, safe_delete -from ..util.six import ensure_str, ensure_text +from ..util.path import safe_delete from ..util.subprocess import run_cmd from ..version import __version__ @@ -25,13 +19,12 @@ DEBUG_SCRIPT = HERE / "debug.py" -class CreatorMeta(object): +class CreatorMeta: def __init__(self): self.error = None -@add_metaclass(ABCMeta) -class Creator(object): +class Creator(metaclass=ABCMeta): """A class that given a python Interpreter creates a virtual environment""" def __init__(self, options, interpreter): @@ -50,14 +43,11 @@ def __init__(self, options, interpreter): self.env = options.env def __repr__(self): - return ensure_str(self.__unicode__()) - - def __unicode__(self): - return "{}({})".format(self.__class__.__name__, ", ".join("{}={}".format(k, v) for k, v in self._args())) + return f"{self.__class__.__name__}({', '.join(f'{k}={v}' for k, v in self._args())})" def _args(self): return [ - ("dest", ensure_text(str(self.dest))), + ("dest", str(self.dest)), ("clear", self.clear), ("no_vcs_ignore", self.no_vcs_ignore), ] @@ -112,16 +102,14 @@ def validate_dest(cls, raw_value): def non_write_able(dest, value): common = Path(*os.path.commonprefix([value.parts, dest.parts])) - raise ArgumentTypeError( - "the destination {} is not write-able at {}".format(dest.relative_to(common), common), - ) + raise ArgumentTypeError(f"the destination {dest.relative_to(common)} is not write-able at {common}") # the file system must be able to encode # note in newer CPython this is always utf-8 https://www.python.org/dev/peps/pep-0529/ encoding = sys.getfilesystemencoding() refused = OrderedDict() kwargs = {"errors": "ignore"} if encoding != "mbcs" else {} - for char in ensure_text(raw_value): + for char in str(raw_value): try: trip = char.encode(encoding, **kwargs).decode(encoding) if trip == char: @@ -130,23 +118,17 @@ def non_write_able(dest, value): except ValueError: refused[char] = None if refused: - raise ArgumentTypeError( - "the file system codec ({}) cannot handle characters {!r} within {!r}".format( - encoding, - "".join(refused.keys()), - raw_value, - ), - ) + bad = "".join(refused.keys()) + msg = f"the file system codec ({encoding}) cannot handle characters {bad!r} within {raw_value!r}" + raise ArgumentTypeError(msg) if os.pathsep in raw_value: - raise ArgumentTypeError( - "destination {!r} must not contain the path separator ({}) as this would break " - "the activation scripts".format(raw_value, os.pathsep), - ) + msg = f"destination {raw_value!r} must not contain the path separator ({os.pathsep})" + raise ArgumentTypeError(f"{msg} as this would break the activation scripts") value = Path(raw_value) if value.exists() and value.is_file(): - raise ArgumentTypeError("the destination {} already exists and is a file".format(value)) - if (3, 3) <= sys.version_info <= (3, 6): + raise ArgumentTypeError(f"the destination {value} already exists and is a file") + if sys.version_info <= (3, 6): # pre 3.6 resolve is always strict, aka must exists, sidestep by using os.path operation dest = Path(os.path.realpath(raw_value)) else: @@ -154,7 +136,7 @@ def non_write_able(dest, value): value = dest while dest: if dest.exists(): - if os.access(ensure_text(str(dest)), os.W_OK): + if os.access(str(dest), os.W_OK): break else: non_write_able(dest, value) @@ -185,14 +167,7 @@ def setup_ignore_vcs(self): # mark this folder to be ignored by VCS, handle https://www.python.org/dev/peps/pep-0610/#registered-vcs git_ignore = self.dest / ".gitignore" if not git_ignore.exists(): - git_ignore.write_text( - dedent( - """ - # created by virtualenv automatically - * - """, - ).lstrip(), - ) + git_ignore.write_text("# created by virtualenv automatically\n*\n") # Mercurial - does not support the .hgignore file inside a subdirectory directly, but only if included via the # subinclude directive from root, at which point on might as well ignore the directory itself, see # https://www.selenic.com/mercurial/hgignore.5.html for more details @@ -208,26 +183,29 @@ def debug(self): self._debug = get_env_debug_info(self.exe, self.debug_script(), self.app_data, self.env) return self._debug - # noinspection PyMethodMayBeStatic - def debug_script(self): + @staticmethod + def debug_script(): return DEBUG_SCRIPT def get_env_debug_info(env_exe, debug_script, app_data, env): env = env.copy() - env.pop(str("PYTHONPATH"), None) + env.pop("PYTHONPATH", None) with app_data.ensure_extracted(debug_script) as debug_script: cmd = [str(env_exe), str(debug_script)] - if WIN_CPYTHON_2: - cmd = [ensure_text(i) for i in cmd] - logging.debug(str("debug via %r"), LogCmd(cmd)) + logging.debug("debug via %r", LogCmd(cmd)) code, out, err = run_cmd(cmd) - # noinspection PyBroadException try: if code != 0: - result = literal_eval(out) + if out: + result = literal_eval(out) + else: + if code == 2 and "file" in err: + # Re-raise FileNotFoundError from `run_cmd()` + raise OSError(err) + raise Exception(err) else: result = json.loads(out) if err: @@ -237,3 +215,9 @@ def get_env_debug_info(env_exe, debug_script, app_data, env): if "sys" in result and "path" in result["sys"]: del result["sys"]["path"][0] return result + + +__all__ = [ + "Creator", + "CreatorMeta", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/describe.py b/src/main/python/pybuilder/_vendor/virtualenv/create/describe.py index 3da78eedc..1ee73a702 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/describe.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/describe.py @@ -1,17 +1,11 @@ -from __future__ import absolute_import, print_function, unicode_literals - from abc import ABCMeta from collections import OrderedDict - -from ...six import add_metaclass +from pathlib import Path from ..info import IS_WIN -from ..util.path import Path -from ..util.six import ensure_text -@add_metaclass(ABCMeta) -class Describe(object): +class Describe(metaclass=ABCMeta): """Given a host interpreter tell us information about what the created interpreter might look like""" suffix = ".exe" if IS_WIN else "" @@ -59,13 +53,12 @@ def stdlib_platform(self): @property def _config_vars(self): if self._conf_vars is None: - self._conf_vars = self._calc_config_vars(ensure_text(str(self.dest))) + self._conf_vars = self._calc_config_vars(self.dest) return self._conf_vars def _calc_config_vars(self, to): - return { - k: (to if v.startswith(self.interpreter.prefix) else v) for k, v in self.interpreter.sysconfig_vars.items() - } + sys_vars = self.interpreter.sysconfig_vars + return {k: (to if v.startswith(self.interpreter.prefix) else v) for k, v in sys_vars.items()} @classmethod def can_describe(cls, interpreter): @@ -74,11 +67,11 @@ def can_describe(cls, interpreter): @property def env_name(self): - return ensure_text(self.dest.parts[-1]) + return self.dest.parts[-1] @property def exe(self): - return self.bin_dir / "{}{}".format(self.exe_stem(), self.suffix) + return self.bin_dir / f"{self.exe_stem()}{self.suffix}" @classmethod def exe_stem(cls): @@ -86,32 +79,37 @@ def exe_stem(cls): raise NotImplementedError def script(self, name): - return self.script_dir / "{}{}".format(name, self.suffix) + return self.script_dir / f"{name}{self.suffix}" -@add_metaclass(ABCMeta) -class Python2Supports(Describe): +class Python2Supports(Describe, metaclass=ABCMeta): @classmethod def can_describe(cls, interpreter): - return interpreter.version_info.major == 2 and super(Python2Supports, cls).can_describe(interpreter) + return interpreter.version_info.major == 2 and super().can_describe(interpreter) -@add_metaclass(ABCMeta) -class Python3Supports(Describe): +class Python3Supports(Describe, metaclass=ABCMeta): @classmethod def can_describe(cls, interpreter): - return interpreter.version_info.major == 3 and super(Python3Supports, cls).can_describe(interpreter) + return interpreter.version_info.major == 3 and super().can_describe(interpreter) -@add_metaclass(ABCMeta) -class PosixSupports(Describe): +class PosixSupports(Describe, metaclass=ABCMeta): @classmethod def can_describe(cls, interpreter): - return interpreter.os == "posix" and super(PosixSupports, cls).can_describe(interpreter) + return interpreter.os == "posix" and super().can_describe(interpreter) -@add_metaclass(ABCMeta) -class WindowsSupports(Describe): +class WindowsSupports(Describe, metaclass=ABCMeta): @classmethod def can_describe(cls, interpreter): - return interpreter.os == "nt" and super(WindowsSupports, cls).can_describe(interpreter) + return interpreter.os == "nt" and super().can_describe(interpreter) + + +__all__ = [ + "Describe", + "Python2Supports", + "Python3Supports", + "PosixSupports", + "WindowsSupports", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/pyenv_cfg.py b/src/main/python/pybuilder/_vendor/virtualenv/create/pyenv_cfg.py index 38eea23e1..9193a28c6 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/pyenv_cfg.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/pyenv_cfg.py @@ -1,12 +1,8 @@ -from __future__ import absolute_import, unicode_literals - import logging from collections import OrderedDict -from ..util.six import ensure_text - -class PyEnvCfg(object): +class PyEnvCfg: def __init__(self, content, path): self.content = content self.path = path @@ -31,10 +27,10 @@ def _read_values(path): return content def write(self): - logging.debug("write %s", ensure_text(str(self.path))) + logging.debug("write %s", self.path) text = "" for key, value in self.content.items(): - line = "{} = {}".format(key, value) + line = f"{key} = {value}" logging.debug("\t%s", line) text += line text += "\n" @@ -58,4 +54,9 @@ def update(self, other): return self def __repr__(self): - return "{}(path={})".format(self.__class__.__name__, self.path) + return f"{self.__class__.__name__}(path={self.path})" + + +__all__ = [ + "PyEnvCfg", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/api.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/api.py index 9d9ce16fc..dd3fc1fc2 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/api.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/api.py @@ -1,21 +1,16 @@ -from __future__ import absolute_import, unicode_literals - import logging import os from abc import ABCMeta - -from ....six import add_metaclass +from pathlib import Path from ...info import fs_supports_symlink -from ...util.path import Path -from ...util.six import ensure_text from ..creator import Creator, CreatorMeta class ViaGlobalRefMeta(CreatorMeta): def __init__(self): - super(ViaGlobalRefMeta, self).__init__() + super().__init__() self.copy_error = None self.symlink_error = None if not fs_supports_symlink(): @@ -30,10 +25,9 @@ def can_symlink(self): return not self.symlink_error -@add_metaclass(ABCMeta) -class ViaGlobalRefApi(Creator): +class ViaGlobalRefApi(Creator, metaclass=ABCMeta): def __init__(self, options, interpreter): - super(ViaGlobalRefApi, self).__init__(options, interpreter) + super().__init__(options, interpreter) self.symlinks = self._should_symlink(options) self.enable_system_site_package = options.system_site @@ -56,7 +50,7 @@ def _should_symlink(options): @classmethod def add_parser_arguments(cls, parser, interpreter, meta, app_data): - super(ViaGlobalRefApi, cls).add_parser_arguments(parser, interpreter, meta, app_data) + super().add_parser_arguments(parser, interpreter, meta, app_data) parser.add_argument( "--system-site-packages", default=False, @@ -92,10 +86,10 @@ def install_patch(self): text = self.env_patch_text() if text: pth = self.purelib / "_virtualenv.pth" - logging.debug("create virtualenv import hook file %s", ensure_text(str(pth))) + logging.debug("create virtualenv import hook file %s", pth) pth.write_text("import _virtualenv") dest_path = self.purelib / "_virtualenv.py" - logging.debug("create %s", ensure_text(str(dest_path))) + logging.debug("create %s", dest_path) dest_path.write_text(text) def env_patch_text(self): @@ -105,8 +99,14 @@ def env_patch_text(self): return text.replace('"__SCRIPT_DIR__"', repr(os.path.relpath(str(self.script_dir), str(self.purelib)))) def _args(self): - return super(ViaGlobalRefApi, self)._args() + [("global", self.enable_system_site_package)] + return super()._args() + [("global", self.enable_system_site_package)] def set_pyenv_cfg(self): - super(ViaGlobalRefApi, self).set_pyenv_cfg() + super().set_pyenv_cfg() self.pyenv_cfg["include-system-site-packages"] = "true" if self.enable_system_site_package else "false" + + +__all__ = [ + "ViaGlobalRefMeta", + "ViaGlobalRefApi", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/builtin_way.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/builtin_way.py index 99a7e8d6d..35927e782 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/builtin_way.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/builtin_way.py @@ -1,17 +1,17 @@ -from __future__ import absolute_import, unicode_literals - from abc import ABCMeta -from .....six import add_metaclass - from ...creator import Creator from ...describe import Describe -@add_metaclass(ABCMeta) -class VirtualenvBuiltin(Creator, Describe): +class VirtualenvBuiltin(Creator, Describe, metaclass=ABCMeta): """A creator that does operations itself without delegation, if we can create it we can also describe it""" def __init__(self, options, interpreter): Creator.__init__(self, options, interpreter) Describe.__init__(self, self.dest, interpreter) + + +__all__ = [ + "VirtualenvBuiltin", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/__init__.py index 01e6d4f49..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, unicode_literals diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/common.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/common.py index 042525df4..63f29928b 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/common.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/common.py @@ -1,45 +1,36 @@ -from __future__ import absolute_import, unicode_literals - from abc import ABCMeta from collections import OrderedDict - -from ......six import add_metaclass +from pathlib import Path from ....describe import PosixSupports, WindowsSupports from ..ref import RefMust, RefWhen -from .....util.path import Path from ..via_global_self_do import ViaGlobalRefVirtualenvBuiltin -@add_metaclass(ABCMeta) -class CPython(ViaGlobalRefVirtualenvBuiltin): +class CPython(ViaGlobalRefVirtualenvBuiltin, metaclass=ABCMeta): @classmethod def can_describe(cls, interpreter): - return interpreter.implementation == "CPython" and super(CPython, cls).can_describe(interpreter) + return interpreter.implementation == "CPython" and super().can_describe(interpreter) @classmethod def exe_stem(cls): return "python" -@add_metaclass(ABCMeta) -class CPythonPosix(CPython, PosixSupports): +class CPythonPosix(CPython, PosixSupports, metaclass=ABCMeta): """Create a CPython virtual environment on POSIX platforms""" @classmethod def _executables(cls, interpreter): host_exe = Path(interpreter.system_executable) major, minor = interpreter.version_info.major, interpreter.version_info.minor - targets = OrderedDict( - (i, None) for i in ["python", "python{}".format(major), "python{}.{}".format(major, minor), host_exe.name] - ) + targets = OrderedDict((i, None) for i in ["python", f"python{major}", f"python{major}.{minor}", host_exe.name]) must = RefMust.COPY if interpreter.version_info.major == 2 else RefMust.NA yield host_exe, list(targets.keys()), must, RefWhen.ANY -@add_metaclass(ABCMeta) -class CPythonWindows(CPython, WindowsSupports): +class CPythonWindows(CPython, WindowsSupports, metaclass=ABCMeta): @classmethod def _executables(cls, interpreter): # symlink of the python executables does not work reliably, copy always instead @@ -63,3 +54,11 @@ def is_mac_os_framework(interpreter): value = "Python3" if interpreter.version_info.major == 3 else "Python" return framework_var == value return False + + +__all__ = [ + "CPython", + "CPythonPosix", + "CPythonWindows", + "is_mac_os_framework", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython2.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython2.py index 15f7726f6..0b0480c7d 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython2.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython2.py @@ -1,25 +1,19 @@ -from __future__ import absolute_import, unicode_literals - import abc import logging - -from ......six import add_metaclass +from pathlib import Path from ..ref import PathRefToDest -from .....util.path import Path from ..python2.python2 import Python2 from .common import CPython, CPythonPosix, CPythonWindows, is_mac_os_framework -@add_metaclass(abc.ABCMeta) -class CPython2(CPython, Python2): +class CPython2(CPython, Python2, metaclass=abc.ABCMeta): """Create a CPython version 2 virtual environment""" @classmethod def sources(cls, interpreter): - for src in super(CPython2, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # include folder needed on Python 2 as we don't have pyenv.cfg host_include_marker = cls.host_include_marker(interpreter) if host_include_marker.exists(): @@ -40,12 +34,10 @@ def include(self): @classmethod def modules(cls): - return [ - "os", # landmark to set sys.prefix - ] + return ["os"] # landmark to set sys.prefix def ensure_directories(self): - dirs = super(CPython2, self).ensure_directories() + dirs = super().ensure_directories() host_include_marker = self.host_include_marker(self.interpreter) if host_include_marker.exists(): dirs.add(self.include.parent) @@ -54,14 +46,12 @@ def ensure_directories(self): return dirs -@add_metaclass(abc.ABCMeta) -class CPython2PosixBase(CPython2, CPythonPosix): +class CPython2PosixBase(CPython2, CPythonPosix, metaclass=abc.ABCMeta): """common to macOs framework builds and other posix CPython2""" @classmethod def sources(cls, interpreter): - for src in super(CPython2PosixBase, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # check if the makefile exists and if so make it available under the virtual environment make_file = Path(interpreter.sysconfig["makefile_filename"]) @@ -75,12 +65,11 @@ class CPython2Posix(CPython2PosixBase): @classmethod def can_describe(cls, interpreter): - return is_mac_os_framework(interpreter) is False and super(CPython2Posix, cls).can_describe(interpreter) + return is_mac_os_framework(interpreter) is False and super().can_describe(interpreter) @classmethod def sources(cls, interpreter): - for src in super(CPython2Posix, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # landmark for exec_prefix exec_marker_file, to_path, _ = cls.from_stdlib(cls.mappings(interpreter), "lib-dynload") yield PathRefToDest(exec_marker_file, dest=to_path) @@ -91,8 +80,7 @@ class CPython2Windows(CPython2, CPythonWindows): @classmethod def sources(cls, interpreter): - for src in super(CPython2Windows, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) py27_dll = Path(interpreter.system_executable).parent / "python27.dll" if py27_dll.exists(): # this might be global in the Windows folder in which case it's alright to be missing yield PathRefToDest(py27_dll, dest=cls.to_bin) @@ -100,3 +88,11 @@ def sources(cls, interpreter): libs = Path(interpreter.system_prefix) / "libs" if libs.exists(): yield PathRefToDest(libs, dest=lambda self, s: self.dest / s.name) + + +__all__ = [ + "CPython2", + "CPython2PosixBase", + "CPython2Posix", + "CPython2Windows", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py index 92d5d0ade..7e399e410 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py @@ -1,30 +1,28 @@ -from __future__ import absolute_import, unicode_literals - import abc +import fnmatch +from itertools import chain +from operator import methodcaller as method +from pathlib import Path from textwrap import dedent -from ......six import add_metaclass - from ....describe import Python3Supports from ..ref import PathRefToDest from ...store import is_store_python -from .....util.path import Path from .common import CPython, CPythonPosix, CPythonWindows, is_mac_os_framework -@add_metaclass(abc.ABCMeta) -class CPython3(CPython, Python3Supports): - """ """ +class CPython3(CPython, Python3Supports, metaclass=abc.ABCMeta): + """CPython 3 or later""" class CPython3Posix(CPythonPosix, CPython3): @classmethod def can_describe(cls, interpreter): - return is_mac_os_framework(interpreter) is False and super(CPython3Posix, cls).can_describe(interpreter) + return is_mac_os_framework(interpreter) is False and super().can_describe(interpreter) def env_patch_text(self): - text = super(CPython3Posix, self).env_patch_text() + text = super().env_patch_text() if self.pyvenv_launch_patch_active(self.interpreter): text += dedent( """ @@ -49,15 +47,23 @@ class CPython3Windows(CPythonWindows, CPython3): def setup_meta(cls, interpreter): if is_store_python(interpreter): # store python is not supported here return None - return super(CPython3Windows, cls).setup_meta(interpreter) + return super().setup_meta(interpreter) @classmethod def sources(cls, interpreter): - for src in super(CPython3Windows, cls).sources(interpreter): - yield src - if not cls.has_shim(interpreter): - for src in cls.include_dll_and_pyd(interpreter): - yield src + if cls.has_shim(interpreter): + refs = cls.executables(interpreter) + else: + refs = chain( + cls.executables(interpreter), + cls.dll_and_pyd(interpreter), + cls.python_zip(interpreter), + ) + yield from refs + + @classmethod + def executables(cls, interpreter): + return super().sources(interpreter) @classmethod def has_shim(cls, interpreter): @@ -76,16 +82,48 @@ def host_python(cls, interpreter): # starting with CPython 3.7 Windows ships with a venvlauncher.exe that avoids the need for dll/pyd copies # it also means the wrapper must be copied to avoid bugs such as https://bugs.python.org/issue42013 return cls.shim(interpreter) - return super(CPython3Windows, cls).host_python(interpreter) + return super().host_python(interpreter) @classmethod - def include_dll_and_pyd(cls, interpreter): + def dll_and_pyd(cls, interpreter): + folders = [Path(interpreter.system_executable).parent] + + # May be missing on some Python hosts. + # See https://github.com/pypa/virtualenv/issues/2368 dll_folder = Path(interpreter.system_prefix) / "DLLs" - host_exe_folder = Path(interpreter.system_executable).parent - for folder in [host_exe_folder, dll_folder]: + if dll_folder.is_dir(): + folders.append(dll_folder) + + for folder in folders: for file in folder.iterdir(): if file.suffix in (".pyd", ".dll"): - yield PathRefToDest(file, dest=cls.to_dll_and_pyd) + yield PathRefToDest(file, cls.to_bin) - def to_dll_and_pyd(self, src): - return self.bin_dir / src.name + @classmethod + def python_zip(cls, interpreter): + """ + "python{VERSION}.zip" contains compiled *.pyc std lib packages, where + "VERSION" is `py_version_nodot` var from the `sysconfig` module. + :see: https://docs.python.org/3/using/windows.html#the-embeddable-package + :see: `discovery.py_info.PythonInfo` class (interpreter). + :see: `python -m sysconfig` output. + + :note: The embeddable Python distribution for Windows includes + "python{VERSION}.zip" and "python{VERSION}._pth" files. User can + move/rename *zip* file and edit `sys.path` by editing *_pth* file. + Here the `pattern` is used only for the default *zip* file name! + """ + pattern = f"*python{interpreter.version_nodot}.zip" + matches = fnmatch.filter(interpreter.path, pattern) + matched_paths = map(Path, matches) + existing_paths = filter(method("exists"), matched_paths) + path = next(existing_paths, None) + if path is not None: + yield PathRefToDest(path, cls.to_bin) + + +__all__ = [ + "CPython3", + "CPython3Posix", + "CPython3Windows", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py index 6f4480a3a..715b02b1a 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py @@ -1,32 +1,27 @@ -# -*- coding: utf-8 -*- """The Apple Framework builds require their own customization""" import logging import os import struct import subprocess from abc import ABCMeta, abstractmethod +from pathlib import Path from textwrap import dedent -from ......six import add_metaclass, text_type - from ..ref import ExePathRefToDest, PathRefToDest, RefMust from .....info import IS_MAC_ARM64 -from .....util.path import Path -from .....util.six import ensure_text from .common import CPython, CPythonPosix, is_mac_os_framework from .cpython2 import CPython2PosixBase from .cpython3 import CPython3 -@add_metaclass(ABCMeta) -class CPythonmacOsFramework(CPython): +class CPythonmacOsFramework(CPython, metaclass=ABCMeta): @classmethod def can_describe(cls, interpreter): - return is_mac_os_framework(interpreter) and super(CPythonmacOsFramework, cls).can_describe(interpreter) + return is_mac_os_framework(interpreter) and super().can_describe(interpreter) def create(self): - super(CPythonmacOsFramework, self).create() + super().create() # change the install_name of the copied python executables target = self.desired_mach_o_image_path() @@ -42,7 +37,7 @@ def create(self): @classmethod def _executables(cls, interpreter): - for _, targets, must, when in super(CPythonmacOsFramework, cls)._executables(interpreter): + for _, targets, must, when in super()._executables(interpreter): # Make sure we use the embedded interpreter inside the framework, even if sys.executable points to the # stub executable in ${sys.prefix}/bin. # See http://groups.google.com/group/python-virtualenv/browse_thread/thread/17cab2f85da75951 @@ -61,8 +56,8 @@ def desired_mach_o_image_path(self): class CPython2macOsFramework(CPythonmacOsFramework, CPython2PosixBase): @classmethod def can_create(cls, interpreter): - if not IS_MAC_ARM64 and super(CPython2macOsFramework, cls).can_describe(interpreter): - return super(CPython2macOsFramework, cls).can_create(interpreter) + if not IS_MAC_ARM64 and super().can_describe(interpreter): + return super().can_create(interpreter) return False def current_mach_o_image_path(self): @@ -73,8 +68,7 @@ def desired_mach_o_image_path(self): @classmethod def sources(cls, interpreter): - for src in super(CPython2macOsFramework, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # landmark for exec_prefix exec_marker_file, to_path, _ = cls.from_stdlib(cls.mappings(interpreter), "lib-dynload") yield PathRefToDest(exec_marker_file, dest=to_path) @@ -89,21 +83,19 @@ def sources(cls, interpreter): @property def reload_code(self): - result = super(CPython2macOsFramework, self).reload_code + result = super().reload_code result = dedent( - """ + f""" # the bundled site.py always adds the global site package if we're on python framework build, escape this import sysconfig config = sysconfig.get_config_vars() before = config["PYTHONFRAMEWORK"] try: config["PYTHONFRAMEWORK"] = "" - {} + {result} finally: config["PYTHONFRAMEWORK"] = before - """.format( - result, - ), + """, ) return result @@ -132,11 +124,11 @@ def fix_signature(self): # Reset the signing on Darwin since the exe has been modified. # Note codesign fails on the original exe, it needs to be copied and moved back. bak_dir.mkdir(parents=True, exist_ok=True) - subprocess.check_call(["cp", text_type(exe), text_type(bak_dir)]) - subprocess.check_call(["mv", text_type(bak_dir / exe.name), text_type(exe)]) + subprocess.check_call(["cp", str(exe), str(bak_dir)]) + subprocess.check_call(["mv", str(bak_dir / exe.name), str(exe)]) bak_dir.rmdir() metadata = "--preserve-metadata=identifier,entitlements,flags,runtime" - cmd = ["codesign", "-s", "-", metadata, "-f", text_type(exe)] + cmd = ["codesign", "-s", "-", metadata, "-f", str(exe)] logging.debug("Changing Signature: %s", cmd) subprocess.check_call(cmd) except Exception: @@ -153,8 +145,7 @@ def desired_mach_o_image_path(self): @classmethod def sources(cls, interpreter): - for src in super(CPython3macOsFramework, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # add a symlink to the host python image exe = Path(interpreter.prefix) / "Python3" @@ -162,20 +153,18 @@ def sources(cls, interpreter): @property def reload_code(self): - result = super(CPython3macOsFramework, self).reload_code + result = super().reload_code result = dedent( - """ + f""" # the bundled site.py always adds the global site package if we're on python framework build, escape this import sys before = sys._framework try: sys._framework = None - {} + {result} finally: sys._framework = before - """.format( - result, - ), + """, ) return result @@ -205,7 +194,7 @@ def fix_mach_o(exe, current, new, max_size): unneeded bits of information, however Mac OS X 10.5 and earlier cannot read this new Link Edit table format. """ try: - logging.debug("change Mach-O for %s from %s to %s", ensure_text(exe), current, ensure_text(new)) + logging.debug("change Mach-O for %s from %s to %s", exe, current, new) _builtin_change_mach_o(max_size)(exe, current, new) except Exception as e: logging.warning("Could not call _builtin_change_mac_o: %s. " "Trying to call install_name_tool instead.", e) @@ -227,7 +216,7 @@ def _builtin_change_mach_o(maxint): LITTLE_ENDIAN = "<" LC_LOAD_DYLIB = 0xC - class FileView(object): + class FileView: """A proxy for file-like objects that exposes a given view of a file. Modified from macholib.""" def __init__(self, file_obj, start=0, size=maxint): @@ -240,15 +229,15 @@ def __init__(self, file_obj, start=0, size=maxint): self._pos = 0 def __repr__(self): - return "".format(self._start, self._end, self._file_obj) + return f"" def tell(self): return self._pos def _checkwindow(self, seek_to, op): if not (self._start <= seek_to <= self._end): - msg = "{} to offset {:d} is outside window [{:d}, {:d}]".format(op, seek_to, self._start, self._end) - raise IOError(msg) + msg = f"{op} to offset {seek_to:d} is outside window [{self._start:d}, {self._end:d}]" + raise OSError(msg) def seek(self, offset, whence=0): seek_to = offset @@ -259,7 +248,7 @@ def seek(self, offset, whence=0): elif whence == os.SEEK_END: seek_to += self._end else: - raise IOError("Invalid whence argument to seek: {!r}".format(whence)) + raise OSError(f"Invalid whence argument to seek: {whence!r}") self._checkwindow(seek_to, "seek") self._file_obj.seek(seek_to) self._pos = seek_to - self._start @@ -345,3 +334,10 @@ def do_file(file, offset=0, size=maxint): do_file(f) return mach_o_change + + +__all__ = [ + "CPythonmacOsFramework", + "CPython2macOsFramework", + "CPython3macOsFramework", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/common.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/common.py index db8612ee8..54dd918d4 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/common.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/common.py @@ -1,41 +1,39 @@ -from __future__ import absolute_import, unicode_literals - import abc - -from ......six import add_metaclass +from pathlib import Path from ..ref import PathRefToDest, RefMust, RefWhen -from .....util.path import Path from ..via_global_self_do import ViaGlobalRefVirtualenvBuiltin -@add_metaclass(abc.ABCMeta) -class PyPy(ViaGlobalRefVirtualenvBuiltin): +class PyPy(ViaGlobalRefVirtualenvBuiltin, metaclass=abc.ABCMeta): @classmethod def can_describe(cls, interpreter): - return interpreter.implementation == "PyPy" and super(PyPy, cls).can_describe(interpreter) + return interpreter.implementation == "PyPy" and super().can_describe(interpreter) @classmethod def _executables(cls, interpreter): host = Path(interpreter.system_executable) - targets = sorted("{}{}".format(name, PyPy.suffix) for name in cls.exe_names(interpreter)) + targets = sorted(f"{name}{PyPy.suffix}" for name in cls.exe_names(interpreter)) must = RefMust.COPY if interpreter.version_info.major == 2 else RefMust.NA yield host, targets, must, RefWhen.ANY + @classmethod + def executables(cls, interpreter): + yield from super().sources(interpreter) + @classmethod def exe_names(cls, interpreter): return { cls.exe_stem(), "python", - "python{}".format(interpreter.version_info.major), - "python{}.{}".format(*interpreter.version_info), + f"python{interpreter.version_info.major}", + f"python{interpreter.version_info.major}.{interpreter.version_info.minor}", } @classmethod def sources(cls, interpreter): - for src in super(PyPy, cls).sources(interpreter): - yield src + yield from cls.executables(interpreter) for host in cls._add_shared_libs(interpreter): yield PathRefToDest(host, dest=lambda self, s: self.bin_dir / s.name) @@ -43,9 +41,13 @@ def sources(cls, interpreter): def _add_shared_libs(cls, interpreter): # https://bitbucket.org/pypy/pypy/issue/1922/future-proofing-virtualenv python_dir = Path(interpreter.system_executable).resolve().parent - for src in cls._shared_libs(python_dir): - yield src + yield from cls._shared_libs(python_dir) @classmethod def _shared_libs(cls, python_dir): raise NotImplementedError + + +__all__ = [ + "PyPy", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy2.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy2.py index f940a0fd6..24b94fcd9 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy2.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy2.py @@ -1,22 +1,17 @@ -from __future__ import absolute_import, unicode_literals - import abc import logging import os - -from ......six import add_metaclass +from pathlib import Path from ....describe import PosixSupports, WindowsSupports from ..ref import PathRefToDest -from .....util.path import Path from ..python2.python2 import Python2 from .common import PyPy -@add_metaclass(abc.ABCMeta) -class PyPy2(PyPy, Python2): - """ """ +class PyPy2(PyPy, Python2, metaclass=abc.ABCMeta): + """PyPy 2""" @classmethod def exe_stem(cls): @@ -24,8 +19,7 @@ def exe_stem(cls): @classmethod def sources(cls, interpreter): - for src in super(PyPy2, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # include folder needed on Python 2 as we don't have pyenv.cfg host_include_marker = cls.host_include_marker(interpreter) if host_include_marker.exists(): @@ -46,7 +40,7 @@ def include(self): @classmethod def modules(cls): # pypy2 uses some modules before the site.py loads, so we need to include these too - return super(PyPy2, cls).modules() + [ + return super().modules() + [ "os", "copy_reg", "genericpath", @@ -61,7 +55,7 @@ def lib_pypy(self): return self.dest / "lib_pypy" def ensure_directories(self): - dirs = super(PyPy2, self).ensure_directories() + dirs = super().ensure_directories() dirs.add(self.lib_pypy) host_include_marker = self.host_include_marker(self.interpreter) if host_include_marker.exists(): @@ -76,7 +70,7 @@ def skip_rewrite(self): PyPy2 built-in imports are handled by this path entry, don't overwrite to not disable it see: https://github.com/pypa/virtualenv/issues/1652 """ - return 'or path.endswith("lib_pypy{}__extensions__") # PyPy2 built-in import marker'.format(os.sep) + return f'or path.endswith("lib_pypy{os.sep}__extensions__") # PyPy2 built-in import marker' class PyPy2Posix(PyPy2, PosixSupports): @@ -84,7 +78,7 @@ class PyPy2Posix(PyPy2, PosixSupports): @classmethod def modules(cls): - return super(PyPy2Posix, cls).modules() + ["posixpath"] + return super().modules() + ["posixpath"] @classmethod def _shared_libs(cls, python_dir): @@ -96,8 +90,7 @@ def lib(self): @classmethod def sources(cls, interpreter): - for src in super(PyPy2Posix, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) host_lib = Path(interpreter.system_prefix) / "lib" if host_lib.exists(): yield PathRefToDest(host_lib, dest=lambda self, _: self.lib) @@ -108,7 +101,7 @@ class Pypy2Windows(PyPy2, WindowsSupports): @classmethod def modules(cls): - return super(Pypy2Windows, cls).modules() + ["ntpath"] + return super().modules() + ["ntpath"] @classmethod def _shared_libs(cls, python_dir): @@ -120,6 +113,12 @@ def _shared_libs(cls, python_dir): @classmethod def sources(cls, interpreter): - for src in super(Pypy2Windows, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) yield PathRefToDest(Path(interpreter.system_prefix) / "libs", dest=lambda self, s: self.dest / s.name) + + +__all__ = [ + "PyPy2", + "PyPy2Posix", + "Pypy2Windows", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py index 0d97ba2fc..0787a37ca 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py @@ -1,25 +1,20 @@ -from __future__ import absolute_import, unicode_literals - import abc - -from ......six import add_metaclass +from pathlib import Path from ....describe import PosixSupports, Python3Supports, WindowsSupports from ..ref import PathRefToDest -from .....util.path import Path from .common import PyPy -@add_metaclass(abc.ABCMeta) -class PyPy3(PyPy, Python3Supports): +class PyPy3(PyPy, Python3Supports, metaclass=abc.ABCMeta): @classmethod def exe_stem(cls): return "pypy3" @classmethod def exe_names(cls, interpreter): - return super(PyPy3, cls).exe_names(interpreter) | {"pypy"} + return super().exe_names(interpreter) | {"pypy"} class PyPy3Posix(PyPy3, PosixSupports): @@ -28,7 +23,7 @@ class PyPy3Posix(PyPy3, PosixSupports): @property def stdlib(self): """PyPy3 respects sysconfig only for the host python, virtual envs is instead lib/pythonx.y/site-packages""" - return self.dest / "lib" / "pypy{}".format(self.interpreter.version_release_str) / "site-packages" + return self.dest / "lib" / f"pypy{self.interpreter.version_release_str}" / "site-packages" @classmethod def _shared_libs(cls, python_dir): @@ -40,10 +35,9 @@ def to_lib(self, src): @classmethod def sources(cls, interpreter): - for src in super(PyPy3Posix, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # PyPy >= 3.8 supports a standard prefix installation, where older - # versions always used a portable/developent style installation. + # versions always used a portable/development style installation. # If this is a standard prefix installation, skip the below: if interpreter.system_prefix == "/usr": return @@ -66,9 +60,15 @@ def sources(cls, interpreter): class Pypy3Windows(PyPy3, WindowsSupports): """PyPy 3 on Windows""" + @property + def less_v37(self): + return self.interpreter.version_info.minor < 7 + @property def stdlib(self): """PyPy3 respects sysconfig only for the host python, virtual envs is instead Lib/site-packages""" + if self.less_v37: + return self.dest / "site-packages" return self.dest / "Lib" / "site-packages" @property @@ -81,5 +81,11 @@ def _shared_libs(cls, python_dir): # glob for libpypy*.dll and libffi*.dll for pattern in ["libpypy*.dll", "libffi*.dll"]: srcs = python_dir.glob(pattern) - for src in srcs: - yield src + yield from srcs + + +__all__ = [ + "PyPy3", + "PyPy3Posix", + "Pypy3Windows", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/python2/python2.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/python2/python2.py index 46e2fa2a5..ad66fb7c9 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/python2/python2.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/python2/python2.py @@ -1,16 +1,11 @@ -from __future__ import absolute_import, unicode_literals - import abc import json import os - -from ......six import add_metaclass +from pathlib import Path from ....describe import Python2Supports from ..ref import PathRefToDest from .....info import IS_ZIPAPP -from .....util.path import Path -from .....util.six import ensure_text from .....util.zipapp import read as read_from_zipapp from ..via_global_self_do import ViaGlobalRefVirtualenvBuiltin @@ -18,11 +13,10 @@ HERE = Path(os.path.abspath(__file__)).parent -@add_metaclass(abc.ABCMeta) -class Python2(ViaGlobalRefVirtualenvBuiltin, Python2Supports): +class Python2(ViaGlobalRefVirtualenvBuiltin, Python2Supports, metaclass=abc.ABCMeta): def create(self): """Perform operations needed to make the created environment work on Python 2""" - super(Python2, self).create() + super().create() # install a patched site-package, the default Python 2 site.py is not smart enough to understand pyvenv.cfg, # so we inject a small shim that can do this, the location of this depends where it's on host sys_std_plat = Path(self.interpreter.system_stdlib_platform) @@ -38,14 +32,14 @@ def create(self): custom_site_text = read_from_zipapp(custom_site) else: custom_site_text = custom_site.read_text() - expected = json.dumps([os.path.relpath(ensure_text(str(i)), ensure_text(str(site_py))) for i in self.libs]) + expected = json.dumps([os.path.relpath(str(i), str(site_py)) for i in self.libs]) custom_site_text = custom_site_text.replace("___EXPECTED_SITE_PACKAGES___", expected) - reload_code = os.linesep.join(" {}".format(i) for i in self.reload_code.splitlines()).lstrip() + reload_code = os.linesep.join(f" {i}" for i in self.reload_code.splitlines()).lstrip() custom_site_text = custom_site_text.replace("# ___RELOAD_CODE___", reload_code) - skip_rewrite = os.linesep.join(" {}".format(i) for i in self.skip_rewrite.splitlines()).lstrip() + skip_rewrite = os.linesep.join(f" {i}" for i in self.skip_rewrite.splitlines()).lstrip() custom_site_text = custom_site_text.replace("# ___SKIP_REWRITE____", skip_rewrite) site_py.write_text(custom_site_text) @@ -60,8 +54,7 @@ def skip_rewrite(self): @classmethod def sources(cls, interpreter): - for src in super(Python2, cls).sources(interpreter): - yield src + yield from super().sources(interpreter) # install files needed to run site.py, either from stdlib or stdlib_platform, at least pyc, but both if exists # if neither exists return the module file to trigger failure mappings, needs_py_module = ( @@ -69,8 +62,8 @@ def sources(cls, interpreter): cls.needs_stdlib_py_module(), ) for req in cls.modules(): - module_file, to_module, module_exists = cls.from_stdlib(mappings, "{}.py".format(req)) - compiled_file, to_compiled, compiled_exists = cls.from_stdlib(mappings, "{}.pyc".format(req)) + module_file, to_module, module_exists = cls.from_stdlib(mappings, f"{req}.py") + compiled_file, to_compiled, compiled_exists = cls.from_stdlib(mappings, f"{req}.pyc") if needs_py_module or module_exists or not compiled_exists: yield PathRefToDest(module_file, dest=to_module) if compiled_exists: diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/ref.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/ref.py index 1e1ca8901..d4d982555 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/ref.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/ref.py @@ -3,34 +3,29 @@ references to elements on the file system, allowing our system to automatically detect what modes it can support given the constraints: e.g. can the file system symlink, can the files be read, executed, etc. """ -from __future__ import absolute_import, unicode_literals import os from abc import ABCMeta, abstractmethod from collections import OrderedDict from stat import S_IXGRP, S_IXOTH, S_IXUSR -from .....six import add_metaclass - from ....info import fs_is_case_sensitive, fs_supports_symlink from ....util.path import copy, make_exe, symlink -from ....util.six import ensure_text -class RefMust(object): +class RefMust: NA = "NA" COPY = "copy" SYMLINK = "symlink" -class RefWhen(object): +class RefWhen: ANY = "ANY" COPY = "copy" SYMLINK = "symlink" -@add_metaclass(ABCMeta) -class PathRef(object): +class PathRef(metaclass=ABCMeta): """Base class that checks if a file reference can be symlink/copied""" FS_SUPPORTS_SYMLINK = fs_supports_symlink() @@ -49,7 +44,7 @@ def __init__(self, src, must=RefMust.NA, when=RefWhen.ANY): self._can_symlink = None if self.exists else False def __repr__(self): - return "{}(src={})".format(self.__class__.__name__, self.src) + return f"{self.__class__.__name__}(src={self.src})" @property def can_read(self): @@ -61,7 +56,7 @@ def can_read(self): except OSError: self._can_read = False else: - self._can_read = os.access(ensure_text(str(self.src)), os.R_OK) + self._can_read = os.access(str(self.src), os.R_OK) return self._can_read @property @@ -94,12 +89,11 @@ def method(self, symlinks): return symlink if symlinks else copy -@add_metaclass(ABCMeta) -class ExePathRef(PathRef): +class ExePathRef(PathRef, metaclass=ABCMeta): """Base class that checks if a executable can be references via symlink/copy""" def __init__(self, src, must=RefMust.NA, when=RefWhen.ANY): - super(ExePathRef, self).__init__(src, must, when) + super().__init__(src, must, when) self._can_run = None @property @@ -125,7 +119,7 @@ class PathRefToDest(PathRef): """Link a path on the file system""" def __init__(self, src, dest, must=RefMust.NA, when=RefWhen.ANY): - super(PathRefToDest, self).__init__(src, must, when) + super().__init__(src, must, when) self.dest = dest def run(self, creator, symlinks): @@ -169,4 +163,14 @@ def run(self, creator, symlinks): make_exe(link_file) def __repr__(self): - return "{}(src={}, alias={})".format(self.__class__.__name__, self.src, self.aliases) + return f"{self.__class__.__name__}(src={self.src}, alias={self.aliases})" + + +__all__ = [ + "ExePathRef", + "ExePathRefToDest", + "PathRefToDest", + "PathRef", + "RefWhen", + "RefMust", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/via_global_self_do.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/via_global_self_do.py index 414942d37..4793b3b50 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/via_global_self_do.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/via_global_self_do.py @@ -1,9 +1,5 @@ -from __future__ import absolute_import, unicode_literals - from abc import ABCMeta -from .....six import add_metaclass - from .ref import ExePathRefToDest, RefMust, RefWhen from ....util.path import ensure_dir @@ -13,19 +9,18 @@ class BuiltinViaGlobalRefMeta(ViaGlobalRefMeta): def __init__(self): - super(BuiltinViaGlobalRefMeta, self).__init__() + super().__init__() self.sources = [] -@add_metaclass(ABCMeta) -class ViaGlobalRefVirtualenvBuiltin(ViaGlobalRefApi, VirtualenvBuiltin): +class ViaGlobalRefVirtualenvBuiltin(ViaGlobalRefApi, VirtualenvBuiltin, metaclass=ABCMeta): def __init__(self, options, interpreter): - super(ViaGlobalRefVirtualenvBuiltin, self).__init__(options, interpreter) + super().__init__(options, interpreter) self._sources = getattr(options.meta, "sources", None) # if we're created as a describer this might be missing @classmethod def can_create(cls, interpreter): - """By default all built-in methods assume that if we can describe it we can create it""" + """By default, all built-in methods assume that if we can describe it we can create it""" # first we must be able to describe it if not cls.can_describe(interpreter): return None @@ -39,11 +34,11 @@ def _sources_can_be_applied(cls, interpreter, meta): for src in cls.sources(interpreter): if src.exists: if meta.can_copy and not src.can_copy: - meta.copy_error = "cannot copy {}".format(src) + meta.copy_error = f"cannot copy {src}" if meta.can_symlink and not src.can_symlink: - meta.symlink_error = "cannot symlink {}".format(src) + meta.symlink_error = f"cannot symlink {src}" else: - msg = "missing required file {}".format(src) + msg = f"missing required file {src}" if src.when == RefMust.NA: meta.error = msg elif src.when == RefMust.COPY: @@ -51,10 +46,7 @@ def _sources_can_be_applied(cls, interpreter, meta): elif src.when == RefMust.SYMLINK: meta.symlink_error = msg if not meta.can_copy and not meta.can_symlink: - meta.error = "neither copy or symlink supported, copy: {} symlink: {}".format( - meta.copy_error, - meta.symlink_error, - ) + meta.error = f"neither copy or symlink supported, copy: {meta.copy_error} symlink: {meta.symlink_error}" if meta.error: break meta.sources.append(src) @@ -98,7 +90,7 @@ def create(self): finally: if true_system_site != self.enable_system_site_package: self.enable_system_site_package = true_system_site - super(ViaGlobalRefVirtualenvBuiltin, self).create() + super().create() def ensure_directories(self): return {self.dest, self.bin_dir, self.script_dir, self.stdlib} | set(self.libs) @@ -108,7 +100,13 @@ def set_pyenv_cfg(self): We directly inject the base prefix and base exec prefix to avoid site.py needing to discover these from home (which usually is done within the interpreter itself) """ - super(ViaGlobalRefVirtualenvBuiltin, self).set_pyenv_cfg() + super().set_pyenv_cfg() self.pyenv_cfg["base-prefix"] = self.interpreter.system_prefix self.pyenv_cfg["base-exec-prefix"] = self.interpreter.system_exec_prefix self.pyenv_cfg["base-executable"] = self.interpreter.system_executable + + +__all__ = [ + "BuiltinViaGlobalRefMeta", + "ViaGlobalRefVirtualenvBuiltin", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/store.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/store.py index 268b61507..a9c559cc1 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/store.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/store.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import, unicode_literals - -from ...util.path import Path +from pathlib import Path def handle_store_python(meta, interpreter): @@ -20,7 +18,7 @@ def is_store_python(interpreter): ) -__all__ = ( +__all__ = [ "handle_store_python", "is_store_python", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/venv.py b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/venv.py index f51d57241..31fd8ec83 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/venv.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/venv.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import logging from copy import copy @@ -10,19 +8,19 @@ from ...util.subprocess import run_cmd from .api import ViaGlobalRefApi, ViaGlobalRefMeta +from .builtin.pypy.pypy3 import Pypy3Windows class Venv(ViaGlobalRefApi): def __init__(self, options, interpreter): self.describe = options.describe - super(Venv, self).__init__(options, interpreter) - self.can_be_inline = ( - interpreter is PythonInfo.current() and interpreter.executable == interpreter.system_executable - ) + super().__init__(options, interpreter) + current = PythonInfo.current() + self.can_be_inline = interpreter is current and interpreter.executable == interpreter.system_executable self._context = None def _args(self): - return super(Venv, self)._args() + ([("describe", self.describe.__class__.__name__)] if self.describe else []) + return super()._args() + ([("describe", self.describe.__class__.__name__)] if self.describe else []) @classmethod def can_create(cls, interpreter): @@ -40,7 +38,19 @@ def create(self): self.create_via_sub_process() for lib in self.libs: ensure_dir(lib) - super(Venv, self).create() + super().create() + self.executables_for_win_pypy_less_v37() + + def executables_for_win_pypy_less_v37(self): + """ + PyPy <= 3.6 (v7.3.3) for Windows contains only pypy3.exe and pypy3w.exe + Venv does not handle non-existing exe sources, e.g. python.exe, so this + patch does it. + """ + creator = self.describe + if isinstance(creator, Pypy3Windows) and creator.less_v37: + for exe in creator.executables(self.interpreter): + exe.run(creator, self.symlinks) def create_inline(self): from venv import EnvBuilder @@ -71,7 +81,7 @@ def get_host_create_cmd(self): def set_pyenv_cfg(self): # prefer venv options over ours, but keep our extra venv_content = copy(self.pyenv_cfg.refresh()) - super(Venv, self).set_pyenv_cfg() + super().set_pyenv_cfg() self.pyenv_cfg.update(venv_content) def __getattribute__(self, item): @@ -81,3 +91,8 @@ def __getattribute__(self, item): if not callable(element) or item in ("script",): return element return object.__getattribute__(self, item) + + +__all__ = [ + "Venv", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/__init__.py index 01e6d4f49..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, unicode_literals diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/builtin.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/builtin.py index d11275daa..fbc57dde6 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/builtin.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/builtin.py @@ -1,11 +1,8 @@ -from __future__ import absolute_import, unicode_literals - import logging import os import sys from ..info import IS_WIN -from ..util.six import ensure_str, ensure_text from .discover import Discover from .py_info import PythonInfo @@ -14,7 +11,7 @@ class Builtin(Discover): def __init__(self, options): - super(Builtin, self).__init__(options) + super().__init__(options) self.python_spec = options.python if options.python else [sys.executable] self.app_data = options.app_data self.try_first_with = options.try_first_with @@ -50,11 +47,8 @@ def run(self): return None def __repr__(self): - return ensure_str(self.__unicode__()) - - def __unicode__(self): spec = self.python_spec[0] if len(self.python_spec) == 1 else self.python_spec - return "{} discover of python_spec={!r}".format(self.__class__.__name__, spec) + return f"{self.__class__.__name__} discover of python_spec={spec!r}" def get_interpreter(key, try_first_with, app_data=None, env=None): @@ -110,10 +104,10 @@ def propose_interpreters(spec, try_first_with, app_data, env=None): paths = get_paths(env) tested_exes = set() for pos, path in enumerate(paths): - path = ensure_text(path) - logging.debug(LazyPathDump(pos, path, env)) + path_str = str(path) + logging.debug(LazyPathDump(pos, path_str, env)) for candidate, match in possible_specs(spec): - found = check_path(candidate, path) + found = check_path(candidate, path_str) if found is not None: exe = os.path.abspath(found) if exe not in tested_exes: @@ -124,7 +118,7 @@ def propose_interpreters(spec, try_first_with, app_data, env=None): def get_paths(env): - path = env.get(str("PATH"), None) + path = env.get("PATH", None) if path is None: try: path = os.confstr("CS_PATH") @@ -137,18 +131,15 @@ def get_paths(env): return paths -class LazyPathDump(object): +class LazyPathDump: def __init__(self, pos, path, env): self.pos = pos self.path = path self.env = env def __repr__(self): - return ensure_str(self.__unicode__()) - - def __unicode__(self): - content = "discover PATH[{}]={}".format(self.pos, self.path) - if self.env.get(str("_VIRTUALENV_DEBUG")): # this is the over the board debug + content = f"discover PATH[{self.pos}]={self.path}" + if self.env.get("_VIRTUALENV_DEBUG"): # this is the over the board debug content += " with =>" for file_name in os.listdir(self.path): try: @@ -178,9 +169,15 @@ def possible_specs(spec): # 4. then maybe it's something exact on PATH - if it was direct lookup implementation no longer counts yield spec.str_spec, False # 5. or from the spec we can deduce a name on path that matches - for exe, match in spec.generate_names(): - yield exe, match + yield from spec.generate_names() class PathPythonInfo(PythonInfo): - """ """ + """python info from path""" + + +__all__ = [ + "get_interpreter", + "Builtin", + "PathPythonInfo", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/cached_py_info.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/cached_py_info.py index af1b30923..930927224 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/cached_py_info.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/cached_py_info.py @@ -4,20 +4,20 @@ cheap, especially not on Windows. To not have to pay this hefty cost every time we apply multiple levels of caching. """ -from __future__ import absolute_import, unicode_literals import logging import os -import pipes +import random import sys from collections import OrderedDict +from pathlib import Path +from shlex import quote +from string import ascii_lowercase, ascii_uppercase, digits +from subprocess import Popen from ..app_data import AppDataDisabled from .py_info import PythonInfo -from ..info import PY2 -from ..util.path import Path -from ..util.six import ensure_text -from ..util.subprocess import Popen, subprocess +from ..util.subprocess import subprocess _CACHE = OrderedDict() _CACHE[Path(sys.executable)] = PythonInfo() @@ -30,7 +30,7 @@ def from_exe(cls, app_data, exe, env=None, raise_on_error=True, ignore_cache=Fal if raise_on_error: raise result else: - logging.info("%s", str(result)) + logging.info("%s", result) result = None return result @@ -51,7 +51,7 @@ def _get_from_cache(cls, app_data, exe, env, ignore_cache=True): def _get_via_file_cache(cls, app_data, path, exe, env): - path_text = ensure_text(str(path)) + path_text = str(path) try: path_modified = path.stat().st_mtime except OSError: @@ -81,10 +81,27 @@ def _get_via_file_cache(cls, app_data, path, exe, env): return py_info +COOKIE_LENGTH: int = 32 + + +def gen_cookie(): + return "".join(random.choice("".join((ascii_lowercase, ascii_uppercase, digits))) for _ in range(COOKIE_LENGTH)) + + def _run_subprocess(cls, exe, app_data, env): py_info_script = Path(os.path.abspath(__file__)).parent / "py_info.py" + # Cookies allow to split the serialized stdout output generated by the script collecting the info from the output + # generated by something else. The right way to deal with it is to create an anonymous pipe and pass its descriptor + # to the child and output to it. But AFAIK all of them are either not cross-platform or too big to implement and are + # not in the stdlib. So the easiest and the shortest way I could mind is just using the cookies. + # We generate pseudorandom cookies because it easy to implement and avoids breakage from outputting modules source + # code, i.e. by debug output libraries. We reverse the cookies to avoid breakages resulting from variable values + # appearing in debug output. + + start_cookie = gen_cookie() + end_cookie = gen_cookie() with app_data.ensure_extracted(py_info_script) as py_info_script: - cmd = [exe, str(py_info_script)] + cmd = [exe, str(py_info_script), start_cookie, end_cookie] # prevent sys.prefix from leaking into the child process - see https://bugs.python.org/issue22490 env = env.copy() env.pop("__PYVENV_LAUNCHER__", None) @@ -104,49 +121,53 @@ def _run_subprocess(cls, exe, app_data, env): out, err, code = "", os_error.strerror, os_error.errno result, failure = None, None if code == 0: + out_starts = out.find(start_cookie[::-1]) + + if out_starts > -1: + pre_cookie = out[:out_starts] + + if pre_cookie: + sys.stdout.write(pre_cookie) + + out = out[out_starts + COOKIE_LENGTH :] + + out_ends = out.find(end_cookie[::-1]) + + if out_ends > -1: + post_cookie = out[out_ends + COOKIE_LENGTH :] + + if post_cookie: + sys.stdout.write(post_cookie) + + out = out[:out_ends] + result = cls._from_json(out) result.executable = exe # keep original executable as this may contain initialization code else: - msg = "failed to query {} with code {}{}{}".format( - exe, - code, - " out: {!r}".format(out) if out else "", - " err: {!r}".format(err) if err else "", - ) - failure = RuntimeError(msg) + msg = f"{exe} with code {code}{f' out: {out!r}' if out else ''}{f' err: {err!r}' if err else ''}" + failure = RuntimeError(f"failed to query {msg}") return failure, result -class LogCmd(object): +class LogCmd: def __init__(self, cmd, env=None): self.cmd = cmd self.env = env def __repr__(self): - def e(v): - return v.decode("utf-8") if isinstance(v, bytes) else v - - cmd_repr = e(" ").join(pipes.quote(e(c)) for c in self.cmd) + cmd_repr = " ".join(quote(str(c)) for c in self.cmd) if self.env is not None: - cmd_repr += e(" env of {!r}").format(self.env) - if PY2: - return cmd_repr.encode("utf-8") + cmd_repr = f"{cmd_repr} env of {self.env!r}" return cmd_repr - def __unicode__(self): - raw = repr(self) - if PY2: - return raw.decode("utf-8") - return raw - def clear(app_data): app_data.py_info_clear() _CACHE.clear() -___all___ = ( +___all___ = [ "from_exe", "clear", "LogCmd", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/discover.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/discover.py index f17e92bef..8950a5534 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/discover.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/discover.py @@ -1,12 +1,7 @@ -from __future__ import absolute_import, unicode_literals - from abc import ABCMeta, abstractmethod -from ...six import add_metaclass - -@add_metaclass(ABCMeta) -class Discover(object): +class Discover(metaclass=ABCMeta): """Discover and provide the requested Python interpreter""" @classmethod @@ -17,7 +12,6 @@ def add_parser_arguments(cls, parser): """ raise NotImplementedError - # noinspection PyUnusedLocal def __init__(self, options): """Create a new discovery mechanism. @@ -31,7 +25,6 @@ def __init__(self, options): def run(self): """Discovers an interpreter. - :return: the interpreter ready to use for virtual environment creation """ raise NotImplementedError @@ -45,3 +38,8 @@ def interpreter(self): self._interpreter = self.run() self._has_run = True return self._interpreter + + +__all__ = [ + "Discover", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_info.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_info.py index abdd1401b..d2462250c 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_info.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_info.py @@ -47,6 +47,10 @@ def abs_path(v): self.version_info = VersionInfo(*list(u(i) for i in sys.version_info)) self.architecture = 64 if sys.maxsize > 2**32 else 32 + # Used to determine some file names. + # See `CPython3Windows.python_zip()`. + self.version_nodot = sysconfig.get_config_var("py_version_nodot") + self.version = u(sys.version) self.os = u(os.name) @@ -520,4 +524,21 @@ def _possible_base(self): if __name__ == "__main__": # dump a JSON representation of the current python # noinspection PyProtectedMember - print(PythonInfo()._to_json()) + argv = sys.argv[1:] + + if len(argv) >= 1: + start_cookie = argv[0] + argv = argv[1:] + else: + start_cookie = "" + + if len(argv) >= 1: + end_cookie = argv[0] + argv = argv[1:] + else: + end_cookie = "" + + sys.argv = sys.argv[:1] + argv + + info = PythonInfo()._to_json() + sys.stdout.write("".join((start_cookie[::-1], info, end_cookie[::-1]))) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_spec.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_spec.py index 62d3e5940..7d2b7f67b 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_spec.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/py_spec.py @@ -1,19 +1,15 @@ -"""A Python specification is an abstract requirement definition of a interpreter""" -from __future__ import absolute_import, unicode_literals +"""A Python specification is an abstract requirement definition of an interpreter""" import os import re -import sys from collections import OrderedDict from ..info import fs_is_case_sensitive -from ..util.six import ensure_str PATTERN = re.compile(r"^(?P[a-zA-Z]+)?(?P[0-9.]+)?(?:-(?P32|64))?$") -IS_WIN = sys.platform == "win32" -class PythonSpec(object): +class PythonSpec: """Contains specification about a Python Interpreter""" def __init__(self, str_spec, implementation, major, minor, micro, architecture, path): @@ -87,7 +83,7 @@ def generate_names(self): for impl, match in impls.items(): for at in range(len(version), -1, -1): cur_ver = version[0:at] - spec = "{}{}".format(impl, ".".join(str(i) for i in cur_ver)) + spec = f"{impl}{'.'.join(str(i) for i in cur_ver)}" yield spec, match @property @@ -108,15 +104,12 @@ def satisfies(self, spec): return False return True - def __unicode__(self): - return "{}({})".format( - type(self).__name__, - ", ".join( - "{}={}".format(k, getattr(self, k)) - for k in ("implementation", "major", "minor", "micro", "architecture", "path") - if getattr(self, k) is not None - ), - ) - def __repr__(self): - return ensure_str(self.__unicode__()) + name = type(self).__name__ + params = "implementation", "major", "minor", "micro", "architecture", "path" + return f"{name}({', '.join(f'{k}={getattr(self, k)}' for k in params if getattr(self, k) is not None)})" + + +__all__ = [ + "PythonSpec", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/__init__.py index 259be976b..4663a3a64 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/__init__.py @@ -1,12 +1,10 @@ -from __future__ import absolute_import, unicode_literals - from ..py_info import PythonInfo from ..py_spec import PythonSpec from .pep514 import discover_pythons class Pep514PythonInfo(PythonInfo): - """ """ + """A Python information acquired from PEP-514""" def propose_interpreters(spec, cache_dir, env): @@ -29,3 +27,9 @@ def propose_interpreters(spec, cache_dir, env): if interpreter is not None: if interpreter.satisfies(spec, impl_must_match=True): yield interpreter + + +__all__ = [ + "Pep514PythonInfo", + "propose_interpreters", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/pep514.py b/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/pep514.py index 26e5198f1..beb1d8197 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/pep514.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/discovery/windows/pep514.py @@ -1,18 +1,10 @@ """Implement https://www.python.org/dev/peps/pep-0514/ to discover interpreters - Windows only""" -from __future__ import absolute_import, print_function, unicode_literals import os import re +import winreg from logging import basicConfig, getLogger -from .... import six - -if six.PY3: - import winreg -else: - # noinspection PyUnresolvedReferences - import _winreg as winreg - LOGGER = getLogger(__name__) @@ -39,8 +31,7 @@ def discover_pythons(): (winreg.HKEY_LOCAL_MACHINE, "HKEY_LOCAL_MACHINE", r"Software\Python", winreg.KEY_WOW64_64KEY, 64), (winreg.HKEY_LOCAL_MACHINE, "HKEY_LOCAL_MACHINE", r"Software\Python", winreg.KEY_WOW64_32KEY, 32), ]: - for spec in process_set(hive, hive_name, key, flags, default_arch): - yield spec + yield from process_set(hive, hive_name, key, flags, default_arch) def process_set(hive, hive_name, key, flags, default_arch): @@ -49,8 +40,7 @@ def process_set(hive, hive_name, key, flags, default_arch): for company in enum_keys(root_key): if company == "PyLauncher": # reserved continue - for spec in process_company(hive_name, company, root_key, default_arch): - yield spec + yield from process_company(hive_name, company, root_key, default_arch) except OSError: pass @@ -77,9 +67,9 @@ def process_tag(hive_name, company, company_key, tag, default_arch): def load_exe(hive_name, company, company_key, tag): - key_path = "{}/{}/{}".format(hive_name, company, tag) + key_path = f"{hive_name}/{company}/{tag}" try: - with winreg.OpenKeyEx(company_key, r"{}\InstallPath".format(tag)) as ip_key: + with winreg.OpenKeyEx(company_key, rf"{tag}\InstallPath") as ip_key: with ip_key: exe = get_value(ip_key, "ExecutablePath") if exe is None: @@ -88,21 +78,21 @@ def load_exe(hive_name, company, company_key, tag): msg(key_path, "no ExecutablePath or default for it") else: - exe = os.path.join(ip, str("python.exe")) + exe = os.path.join(ip, "python.exe") if exe is not None and os.path.exists(exe): args = get_value(ip_key, "ExecutableArguments") return exe, args else: - msg(key_path, "could not load exe with value {}".format(exe)) + msg(key_path, f"could not load exe with value {exe}") except OSError: - msg("{}/{}".format(key_path, "InstallPath"), "missing") + msg(f"{key_path}/InstallPath", "missing") return None def load_arch_data(hive_name, company, tag, tag_key, default_arch): arch_str = get_value(tag_key, "SysArchitecture") if arch_str is not None: - key_path = "{}/{}/{}/SysArchitecture".format(hive_name, company, tag) + key_path = f"{hive_name}/{company}/{tag}/SysArchitecture" try: return parse_arch(arch_str) except ValueError as sys_arch: @@ -111,20 +101,20 @@ def load_arch_data(hive_name, company, tag, tag_key, default_arch): def parse_arch(arch_str): - if isinstance(arch_str, six.string_types): + if isinstance(arch_str, str): match = re.match(r"^(\d+)bit$", arch_str) if match: return int(next(iter(match.groups()))) - error = "invalid format {}".format(arch_str) + error = f"invalid format {arch_str}" else: - error = "arch is not string: {}".format(repr(arch_str)) + error = f"arch is not string: {repr(arch_str)}" raise ValueError(error) def load_version_data(hive_name, company, tag, tag_key): for candidate, key_path in [ - (get_value(tag_key, "SysVersion"), "{}/{}/{}/SysVersion".format(hive_name, company, tag)), - (tag, "{}/{}/{}".format(hive_name, company, tag)), + (get_value(tag_key, "SysVersion"), f"{hive_name}/{company}/{tag}/SysVersion"), + (tag, f"{hive_name}/{company}/{tag}"), ]: if candidate is not None: try: @@ -135,18 +125,18 @@ def load_version_data(hive_name, company, tag, tag_key): def parse_version(version_str): - if isinstance(version_str, six.string_types): + if isinstance(version_str, str): match = re.match(r"^(\d+)(?:\.(\d+))?(?:\.(\d+))?$", version_str) if match: return tuple(int(i) if i is not None else None for i in match.groups()) - error = "invalid format {}".format(version_str) + error = f"invalid format {version_str}" else: - error = "version is not string: {}".format(repr(version_str)) + error = f"version is not string: {version_str!r}" raise ValueError(error) def msg(path, what): - LOGGER.warning("PEP-514 violation in Windows Registry at {} error: {}".format(path, what)) + LOGGER.warning(f"PEP-514 violation in Windows Registry at {path} error: {what}") def _run(): diff --git a/src/main/python/pybuilder/_vendor/virtualenv/info.py b/src/main/python/pybuilder/_vendor/virtualenv/info.py index 7d5e86d78..a4fc4bf79 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/info.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/info.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import logging import os import platform @@ -9,13 +7,10 @@ IMPLEMENTATION = platform.python_implementation() IS_PYPY = IMPLEMENTATION == "PyPy" IS_CPYTHON = IMPLEMENTATION == "CPython" -PY3 = sys.version_info[0] == 3 -PY2 = sys.version_info[0] == 2 IS_WIN = sys.platform == "win32" IS_MAC_ARM64 = sys.platform == "darwin" and platform.machine() == "arm64" ROOT = os.path.realpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir)) IS_ZIPAPP = os.path.isfile(ROOT) -WIN_CPYTHON_2 = IS_CPYTHON and IS_WIN and PY2 _CAN_SYMLINK = _FS_CASE_SENSITIVE = _CFG_DIR = _DATA_DIR = None @@ -39,7 +34,7 @@ def fs_supports_symlink(): if IS_WIN: with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file: temp_dir = os.path.dirname(tmp_file.name) - dest = os.path.join(temp_dir, "{}-{}".format(tmp_file.name, "b")) + dest = os.path.join(temp_dir, f"{tmp_file.name}-{'b'}") try: os.symlink(tmp_file.name, dest) can = True @@ -55,12 +50,10 @@ def fs_supports_symlink(): __all__ = ( "IS_PYPY", "IS_CPYTHON", - "PY3", - "PY2", "IS_WIN", "fs_is_case_sensitive", "fs_supports_symlink", "ROOT", "IS_ZIPAPP", - "WIN_CPYTHON_2", + "IS_MAC_ARM64", ) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/report.py b/src/main/python/pybuilder/_vendor/virtualenv/report.py index c1ae3b4cd..0236f2195 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/report.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/report.py @@ -1,10 +1,6 @@ -from __future__ import absolute_import, unicode_literals - import logging import sys -from .util.six import ensure_str - LEVELS = { 0: logging.CRITICAL, 1: logging.ERROR, @@ -26,10 +22,10 @@ def setup_report(verbosity, show_pid=False): msg_format = "%(message)s" if level <= logging.DEBUG: locate = "module" - msg_format = "%(relativeCreated)d {} [%(levelname)s %({})s:%(lineno)d]".format(msg_format, locate) + msg_format = f"%(relativeCreated)d {msg_format} [%(levelname)s %({locate})s:%(lineno)d]" if show_pid: - msg_format = "[%(process)d] " + msg_format - formatter = logging.Formatter(ensure_str(msg_format)) + msg_format = f"[%(process)d] {msg_format}" + formatter = logging.Formatter(msg_format) stream_handler = logging.StreamHandler(stream=sys.stdout) stream_handler.setLevel(level) LOGGER.setLevel(logging.NOTSET) @@ -46,8 +42,8 @@ def _clean_handlers(log): log.removeHandler(log_handler) -__all__ = ( +__all__ = [ "LEVELS", "MAX_LEVEL", "setup_report", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/run/__init__.py index f129fc6b2..e26d17375 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/__init__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import logging import os from functools import partial @@ -69,7 +67,7 @@ def build_parser(args=None, options=None, setup_logging=True, env=None): discover = get_discover(parser, args) parser._interpreter = interpreter = discover.interpreter if interpreter is None: - raise RuntimeError("failed to find interpreter for {}".format(discover)) + raise RuntimeError(f"failed to find interpreter for {discover}") elements = [ CreatorSelector(interpreter, parser), SeederSelector(interpreter, parser), @@ -130,13 +128,13 @@ def add_version_flag(parser): parser.add_argument( "--version", action="version", - version="%(prog)s {} from {}".format(__version__, virtualenv.__file__), + version=f"%(prog)s {__version__} from {virtualenv.__file__}", help="display the version of the virtualenv package and its location, then exit", ) def _do_report_setup(parser, args, setup_logging): - level_map = ", ".join("{}={}".format(logging.getLevelName(l), c) for c, l in sorted(list(LEVELS.items()))) + level_map = ", ".join(f"{logging.getLevelName(l)}={c}" for c, l in sorted(list(LEVELS.items()))) msg = "verbosity = verbose - quiet, default {}, mapping => {}" verbosity_group = parser.add_argument_group( title="verbosity", @@ -150,7 +148,7 @@ def _do_report_setup(parser, args, setup_logging): setup_report(option.verbosity) -__all__ = ( +__all__ = [ "cli_run", "session_via_cli", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/activators.py b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/activators.py index 8180981b1..320cae7ca 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/activators.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/activators.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - from argparse import ArgumentTypeError from collections import OrderedDict @@ -12,14 +10,14 @@ def __init__(self, interpreter, parser): possible = OrderedDict( (k, v) for k, v in self.options("virtualenv.activate").items() if v.supports(interpreter) ) - super(ActivationSelector, self).__init__(interpreter, parser, "activators", possible) + super().__init__(interpreter, parser, "activators", possible) self.parser.description = "options for activation scripts" self.active = None def add_selector_arg_parse(self, name, choices): self.default = ",".join(choices) self.parser.add_argument( - "--{}".format(name), + f"--{name}", default=self.default, metavar="comma_sep_list", required=False, @@ -31,7 +29,7 @@ def _extract_activators(self, entered_str): elements = [e.strip() for e in entered_str.split(",") if e.strip()] missing = [e for e in elements if e not in self.possible] if missing: - raise ArgumentTypeError("the following activators are not available {}".format(",".join(missing))) + raise ArgumentTypeError(f"the following activators are not available {','.join(missing)}") return elements def handle_selected_arg_parse(self, options): @@ -54,3 +52,8 @@ def handle_selected_arg_parse(self, options): def create(self, options): return [activator_class(options) for activator_class in self.active.values()] + + +__all__ = [ + "ActivationSelector", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/base.py b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/base.py index 227efe1df..657c2f9d8 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/base.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/base.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - import sys from collections import OrderedDict @@ -13,7 +11,7 @@ importlib_metadata_version = tuple(int(i) for i in version("importlib_metadata").split(".")[:2]) -class PluginLoader(object): +class PluginLoader: _OPTIONS = None _ENTRY_POINTS = None @@ -52,14 +50,20 @@ def add_selector_arg_parse(self, name, choices): def handle_selected_arg_parse(self, options): selected = getattr(options, self.name) if selected not in self.possible: - raise RuntimeError("No implementation for {}".format(self.interpreter)) + raise RuntimeError(f"No implementation for {self.interpreter}") self._impl_class = self.possible[selected] self.populate_selected_argparse(selected, options.app_data) return selected def populate_selected_argparse(self, selected, app_data): - self.parser.description = "options for {} {}".format(self.name, selected) + self.parser.description = f"options for {self.name} {selected}" self._impl_class.add_parser_arguments(self.parser, self.interpreter, app_data) def create(self, options): return self._impl_class(options, self.interpreter) + + +__all__ = [ + "PluginLoader", + "ComponentBuilder", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/creators.py b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/creators.py index aee9dc7f5..39f2dd263 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/creators.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/creators.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - from collections import OrderedDict, defaultdict, namedtuple from ...create.describe import Describe @@ -13,7 +11,7 @@ class CreatorSelector(ComponentBuilder): def __init__(self, interpreter, parser): creators, self.key_to_meta, self.describe, self.builtin_key = self.for_interpreter(interpreter) - super(CreatorSelector, self).__init__(interpreter, parser, "creator", creators) + super().__init__(interpreter, parser, "creator", creators) @classmethod def for_interpreter(cls, interpreter): @@ -37,10 +35,10 @@ def for_interpreter(cls, interpreter): describe = creator_class if not key_to_meta: if errors: - rows = ["{} for creators {}".format(k, ", ".join(i.__name__ for i in v)) for k, v in errors.items()] + rows = [f"{k} for creators {', '.join(i.__name__ for i in v)}" for k, v in errors.items()] raise RuntimeError("\n".join(rows)) else: - raise RuntimeError("No virtualenv implementation for {}".format(interpreter)) + raise RuntimeError(f"No virtualenv implementation for {interpreter}") return CreatorInfo( key_to_class=key_to_class, key_to_meta=key_to_meta, @@ -53,13 +51,11 @@ def add_selector_arg_parse(self, name, choices): choices = sorted(choices, key=lambda a: 0 if a == "builtin" else 1) default_value = self._get_default(choices) self.parser.add_argument( - "--{}".format(name), + f"--{name}", choices=choices, default=default_value, required=False, - help="create environment via{}".format( - "" if self.builtin_key is None else " (builtin = {})".format(self.builtin_key), - ), + help=f"create environment via{'' if self.builtin_key is None else f' (builtin = {self.builtin_key})'}", ) @staticmethod @@ -67,11 +63,17 @@ def _get_default(choices): return next(iter(choices)) def populate_selected_argparse(self, selected, app_data): - self.parser.description = "options for {} {}".format(self.name, selected) + self.parser.description = f"options for {self.name} {selected}" self._impl_class.add_parser_arguments(self.parser, self.interpreter, self.key_to_meta[selected], app_data) def create(self, options): options.meta = self.key_to_meta[getattr(options, self.name)] if not issubclass(self._impl_class, Describe): options.describe = self.describe(options, self.interpreter) - return super(CreatorSelector, self).create(options) + return super().create(options) + + +__all__ = [ + "CreatorSelector", + "CreatorInfo", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/discovery.py b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/discovery.py index ac9b7f526..13f39ed11 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/discovery.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/discovery.py @@ -1,10 +1,8 @@ -from __future__ import absolute_import, unicode_literals - from .base import PluginLoader class Discovery(PluginLoader): - """ """ + """Discovery plugins""" def get_discover(parser, args): @@ -33,3 +31,9 @@ def get_discover(parser, args): def _get_default_discovery(discover_types): return list(discover_types.keys()) + + +__all__ = [ + "get_discover", + "Discovery", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/seeders.py b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/seeders.py index d182c6f73..1a51d2ec6 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/seeders.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/plugin/seeders.py @@ -1,16 +1,14 @@ -from __future__ import absolute_import, unicode_literals - from .base import ComponentBuilder class SeederSelector(ComponentBuilder): def __init__(self, interpreter, parser): possible = self.options("virtualenv.seed") - super(SeederSelector, self).__init__(interpreter, parser, "seeder", possible) + super().__init__(interpreter, parser, "seeder", possible) def add_selector_arg_parse(self, name, choices): self.parser.add_argument( - "--{}".format(name), + f"--{name}", choices=choices, default=self._get_default(), required=False, @@ -29,7 +27,12 @@ def _get_default(): return "app-data" def handle_selected_arg_parse(self, options): - return super(SeederSelector, self).handle_selected_arg_parse(options) + return super().handle_selected_arg_parse(options) def create(self, options): return self._impl_class(options) + + +__all__ = [ + "SeederSelector", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/run/session.py b/src/main/python/pybuilder/_vendor/virtualenv/run/session.py index be2f502d6..84777fe36 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/run/session.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/run/session.py @@ -1,12 +1,8 @@ -from __future__ import absolute_import, unicode_literals - import json import logging -from ..util.six import ensure_text - -class Session(object): +class Session: """Represents a virtual environment creation session""" def __init__(self, verbosity, app_data, interpreter, creator, seeder, activators): @@ -49,7 +45,7 @@ def run(self): self.creator.pyenv_cfg.write() def _create(self): - logging.info("create virtual environment via %s", ensure_text(str(self.creator))) + logging.info("create virtual environment via %s", self.creator) self.creator.run() logging.debug(_DEBUG_MARKER) logging.debug("%s", _Debug(self.creator)) @@ -61,10 +57,8 @@ def _seed(self): def _activate(self): if self.activators: - logging.info( - "add activators for %s", - ", ".join(type(i).__name__.replace("Activator", "") for i in self.activators), - ) + active = ", ".join(type(i).__name__.replace("Activator", "") for i in self.activators) + logging.info("add activators for %s", active) for activator in self.activators: activator.generate(self.creator) @@ -78,14 +72,16 @@ def __exit__(self, exc_type, exc_val, exc_tb): _DEBUG_MARKER = "=" * 30 + " target debug " + "=" * 30 -class _Debug(object): +class _Debug: """lazily populate debug""" def __init__(self, creator): self.creator = creator - def __unicode__(self): - return ensure_text(repr(self)) - def __repr__(self): return json.dumps(self.creator.debug, indent=2) + + +__all__ = [ + "Session", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/__init__.py index 01e6d4f49..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, unicode_literals diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/base_embed.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/base_embed.py index 0159e02ca..b0bcbc38d 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/base_embed.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/base_embed.py @@ -1,11 +1,5 @@ -from __future__ import absolute_import, unicode_literals - from abc import ABCMeta - -from ....six import add_metaclass - -from ...util.path import Path -from ...util.six import ensure_str, ensure_text +from pathlib import Path from ..seeder import Seeder from ..wheels import Version @@ -13,10 +7,9 @@ PERIODIC_UPDATE_ON_BY_DEFAULT = True -@add_metaclass(ABCMeta) -class BaseEmbed(Seeder): +class BaseEmbed(Seeder, metaclass=ABCMeta): def __init__(self, options): - super(BaseEmbed, self).__init__(options, enabled=options.no_seed is False) + super().__init__(options, enabled=options.no_seed is False) self.download = options.download self.extra_search_dir = [i.resolve() for i in options.extra_search_dir if i.exists()] @@ -44,9 +37,9 @@ def distributions(cls): def distribution_to_versions(self): return { - distribution: getattr(self, "{}_version".format(distribution)) + distribution: getattr(self, f"{distribution}_version") for distribution in self.distributions() - if getattr(self, "no_{}".format(distribution)) is False + if getattr(self, f"no_{distribution}") is False } @classmethod @@ -57,14 +50,14 @@ def add_parser_arguments(cls, parser, interpreter, app_data): "--never-download", dest="download", action="store_false", - help="pass to disable download of the latest {} from PyPI".format("/".join(cls.distributions())), + help=f"pass to disable download of the latest {'/'.join(cls.distributions())} from PyPI", default=True, ) group.add_argument( "--download", dest="download", action="store_true", - help="pass to enable download of the latest {} from PyPI".format("/".join(cls.distributions())), + help=f"pass to enable download of the latest {'/'.join(cls.distributions())} from PyPI", default=False, ) parser.add_argument( @@ -77,18 +70,18 @@ def add_parser_arguments(cls, parser, interpreter, app_data): ) for distribution, default in cls.distributions().items(): parser.add_argument( - "--{}".format(distribution), + f"--{distribution}", dest=distribution, metavar="version", - help="version of {} to install as seed: embed, bundle or exact version".format(distribution), + help=f"version of {distribution} to install as seed: embed, bundle or exact version", default=default, ) for distribution in cls.distributions(): parser.add_argument( - "--no-{}".format(distribution), - dest="no_{}".format(distribution), + f"--no-{distribution}", + dest=f"no_{distribution}", action="store_true", - help="do not install {}".format(distribution), + help=f"do not install {distribution}", default=False, ) parser.add_argument( @@ -99,20 +92,20 @@ def add_parser_arguments(cls, parser, interpreter, app_data): default=not PERIODIC_UPDATE_ON_BY_DEFAULT, ) - def __unicode__(self): + def __repr__(self): result = self.__class__.__name__ result += "(" if self.extra_search_dir: - result += "extra_search_dir={},".format(", ".join(ensure_text(str(i)) for i in self.extra_search_dir)) - result += "download={},".format(self.download) + result += f"extra_search_dir={', '.join(str(i) for i in self.extra_search_dir)}," + result += f"download={self.download}," for distribution in self.distributions(): - if getattr(self, "no_{}".format(distribution)): + if getattr(self, f"no_{distribution}"): continue - result += " {}{},".format( - distribution, - "={}".format(getattr(self, "{}_version".format(distribution), None) or "latest"), - ) + ver = f"={getattr(self, f'{distribution}_version', None) or 'latest'}" + result += f" {distribution}{ver}," return result[:-1] + ")" - def __repr__(self): - return ensure_str(self.__unicode__()) + +__all__ = [ + "BaseEmbed", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/pip_invoke.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/pip_invoke.py index 740990e1d..81959ffc9 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/pip_invoke.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/pip_invoke.py @@ -1,18 +1,16 @@ -from __future__ import absolute_import, unicode_literals - import logging from contextlib import contextmanager +from subprocess import Popen from ...discovery.cached_py_info import LogCmd from .base_embed import BaseEmbed -from ...util.subprocess import Popen from ..wheels import Version, get_wheel, pip_wheel_env_run class PipInvoke(BaseEmbed): def __init__(self, options): - super(PipInvoke, self).__init__(options) + super().__init__(options) def run(self, creator): if not self.enabled: @@ -28,7 +26,7 @@ def _execute(cmd, env): process = Popen(cmd, env=env) process.communicate() if process.returncode != 0: - raise RuntimeError("failed seed with code {}".format(process.returncode)) + raise RuntimeError(f"failed seed with code {process.returncode}") return process @contextmanager @@ -49,9 +47,14 @@ def get_pip_install_cmd(self, exe, for_py_version): env=self.env, ) if wheel is None: - raise RuntimeError("could not get wheel for distribution {}".format(dist)) + raise RuntimeError(f"could not get wheel for distribution {dist}") folders.add(str(wheel.path.parent)) cmd.append(Version.as_pip_req(dist, wheel.version)) for folder in sorted(folders): cmd.extend(["--find-links", str(folder)]) yield cmd + + +__all__ = [ + "PipInvoke", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/base.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/base.py index 31dcc9d20..f883704e0 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/base.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/base.py @@ -1,23 +1,19 @@ -from __future__ import absolute_import, unicode_literals - import logging import os import re import zipfile from abc import ABCMeta, abstractmethod +from configparser import ConfigParser from itertools import chain +from pathlib import Path from tempfile import mkdtemp -from distlib.scripts import ScriptMaker, enquote_executable -from ......six import PY3, add_metaclass +from ......distlib.scripts import ScriptMaker, enquote_executable -from .....util import ConfigParser -from .....util.path import Path, safe_delete -from .....util.six import ensure_text +from .....util.path import safe_delete -@add_metaclass(ABCMeta) -class PipInstall(object): +class PipInstall(metaclass=ABCMeta): def __init__(self, wheel, creator, image_folder): self._wheel = wheel self._creator = creator @@ -71,10 +67,7 @@ def _shorten_path_if_needed(self, zip_ref): self._image_dir = Path(to_folder) def _records_text(self, files): - record_data = "\n".join( - "{},,".format(os.path.relpath(ensure_text(str(rec)), ensure_text(str(self._image_dir)))) for rec in files - ) - return record_data + return "\n".join(f"{os.path.relpath(str(rec), str(self._image_dir))},," for rec in files) def _generate_new_files(self): new_files = set() @@ -82,17 +75,17 @@ def _generate_new_files(self): installer.write_text("pip\n") new_files.add(installer) # inject a no-op root element, as workaround for bug in https://github.com/pypa/pip/issues/7226 - marker = self._image_dir / "{}.virtualenv".format(self._dist_info.stem) + marker = self._image_dir / f"{self._dist_info.stem}.virtualenv" marker.write_text("") new_files.add(marker) folder = mkdtemp() try: to_folder = Path(folder) - rel = os.path.relpath(ensure_text(str(self._creator.script_dir)), ensure_text(str(self._creator.purelib))) + rel = os.path.relpath(str(self._creator.script_dir), str(self._creator.purelib)) version_info = self._creator.interpreter.version_info for name, module in self._console_scripts.items(): new_files.update( - Path(os.path.normpath(ensure_text(str(self._image_dir / rel / i.name)))) + Path(os.path.normpath(str(self._image_dir / rel / i.name))) for i in self._create_console_entry_point(name, module, to_folder, version_info) ) finally: @@ -111,8 +104,7 @@ def _dist_info(self): self.__dist_info = filename break else: - msg = "no .dist-info at {}, has {}".format(self._image_dir, ", ".join(files)) # pragma: no cover - raise RuntimeError(msg) # pragma: no cover + raise RuntimeError(f"no .dist-info at {self._image_dir}, has {', '.join(files)}") # pragma: no cover return self.__dist_info @abstractmethod @@ -127,10 +119,9 @@ def _console_scripts(self): self._console_entry_points = {} entry_points = self._dist_info / "entry_points.txt" if entry_points.exists(): - parser = ConfigParser.ConfigParser() + parser = ConfigParser() with entry_points.open() as file_handler: - reader = getattr(parser, "read_file" if PY3 else "readfp") - reader(file_handler) + parser.read_file(file_handler) if "console_scripts" in parser.sections(): for name, value in parser.items("console_scripts"): match = re.match(r"(.*?)-?\d\.?\d*", name) @@ -142,7 +133,7 @@ def _console_scripts(self): def _create_console_entry_point(self, name, value, to_folder, version_info): result = [] maker = ScriptMakerCustom(to_folder, version_info, self._creator.exe, name) - specification = "{} = {}".format(name, value) + specification = f"{name} = {value}" new_files = maker.make(specification) result.extend(Path(i) for i in new_files) return result @@ -187,7 +178,7 @@ def has_image(self): class ScriptMakerCustom(ScriptMaker): def __init__(self, target_dir, version_info, executable, name): - super(ScriptMakerCustom, self).__init__(None, str(target_dir)) + super().__init__(None, str(target_dir)) self.clobber = True # overwrite self.set_mode = True # ensure they are executable self.executable = enquote_executable(str(executable)) @@ -196,5 +187,10 @@ def __init__(self, target_dir, version_info, executable, name): self._name = name def _write_script(self, names, shebang, script_bytes, filenames, ext): - names.add("{}{}.{}".format(self._name, *self.version_info)) - super(ScriptMakerCustom, self)._write_script(names, shebang, script_bytes, filenames, ext) + names.add(f"{self._name}{self.version_info[0]}.{self.version_info[1]}") + super()._write_script(names, shebang, script_bytes, filenames, ext) + + +__all__ = [ + "PipInstall", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/copy.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/copy.py index 9e2d7ac2c..2833ffe5c 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/copy.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/copy.py @@ -1,9 +1,7 @@ -from __future__ import absolute_import, unicode_literals - import os +from pathlib import Path -from .....util.path import Path, copy -from .....util.six import ensure_text +from .....util.path import copy from .base import PipInstall @@ -14,22 +12,27 @@ def _sync(self, src, dst): def _generate_new_files(self): # create the pyc files - new_files = super(CopyPipInstall, self)._generate_new_files() + new_files = super()._generate_new_files() new_files.update(self._cache_files()) return new_files def _cache_files(self): version = self._creator.interpreter.version_info - py_c_ext = ".{}-{}{}.pyc".format(self._creator.interpreter.implementation.lower(), version.major, version.minor) - for root, dirs, files in os.walk(ensure_text(str(self._image_dir)), topdown=True): + py_c_ext = f".{self._creator.interpreter.implementation.lower()}-{version.major}{version.minor}.pyc" + for root, dirs, files in os.walk(str(self._image_dir), topdown=True): root_path = Path(root) for name in files: if name.endswith(".py"): - yield root_path / "{}{}".format(name[:-3], py_c_ext) + yield root_path / f"{name[:-3]}{py_c_ext}" for name in dirs: yield root_path / name / "__pycache__" def _fix_records(self, new_files): extra_record_data_str = self._records_text(new_files) - with open(ensure_text(str(self._dist_info / "RECORD")), "ab") as file_handler: + with (self._dist_info / "RECORD").open("ab") as file_handler: file_handler.write(extra_record_data_str.encode("utf-8")) + + +__all__ = [ + "CopyPipInstall", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/symlink.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/symlink.py index 5c2f0bb8d..973c0371c 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/symlink.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/pip_install/symlink.py @@ -1,29 +1,20 @@ -from __future__ import absolute_import, unicode_literals - import os -import subprocess from stat import S_IREAD, S_IRGRP, S_IROTH +from subprocess import PIPE, Popen from .....util.path import safe_delete, set_tree -from .....util.six import ensure_text -from .....util.subprocess import Popen from .base import PipInstall class SymlinkPipInstall(PipInstall): def _sync(self, src, dst): - src_str = ensure_text(str(src)) - dest_str = ensure_text(str(dst)) - os.symlink(src_str, dest_str) + os.symlink(str(src), str(dst)) def _generate_new_files(self): # create the pyc files, as the build image will be R/O - process = Popen( - [ensure_text(str(self._creator.exe)), "-m", "compileall", ensure_text(str(self._image_dir))], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) + cmd = [str(self._creator.exe), "-m", "compileall", str(self._image_dir)] + process = Popen(cmd, stdout=PIPE, stderr=PIPE) process.communicate() # the root pyc is shared, so we'll not symlink that - but still add the pyc files to the RECORD for close root_py_cache = self._image_dir / "__pycache__" @@ -32,7 +23,7 @@ def _generate_new_files(self): new_files.update(root_py_cache.iterdir()) new_files.add(root_py_cache) safe_delete(root_py_cache) - core_new_files = super(SymlinkPipInstall, self)._generate_new_files() + core_new_files = super()._generate_new_files() # remove files that are within the image folder deeper than one level (as these will be not linked directly) for file in core_new_files: try: @@ -47,15 +38,20 @@ def _generate_new_files(self): def _fix_records(self, new_files): new_files.update(i for i in self._image_dir.iterdir()) extra_record_data_str = self._records_text(sorted(new_files, key=str)) - with open(ensure_text(str(self._dist_info / "RECORD")), "wb") as file_handler: + with open(str(self._dist_info / "RECORD"), "wb") as file_handler: file_handler.write(extra_record_data_str.encode("utf-8")) def build_image(self): - super(SymlinkPipInstall, self).build_image() + super().build_image() # protect the image by making it read only set_tree(self._image_dir, S_IREAD | S_IRGRP | S_IROTH) def clear(self): if self._image_dir.exists(): safe_delete(self._image_dir) - super(SymlinkPipInstall, self).clear() + super().clear() + + +__all__ = [ + "SymlinkPipInstall", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/via_app_data.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/via_app_data.py index 5a1a1033c..881b2b513 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/via_app_data.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/embed/via_app_data/via_app_data.py @@ -1,17 +1,16 @@ """Bootstrap""" -from __future__ import absolute_import, unicode_literals import logging import sys import traceback from contextlib import contextmanager +from pathlib import Path from subprocess import CalledProcessError from threading import Lock, Thread from ....info import fs_supports_symlink from ..base_embed import BaseEmbed from ...wheels import get_wheel -from ....util.path import Path from .pip_install.copy import CopyPipInstall from .pip_install.symlink import SymlinkPipInstall @@ -19,20 +18,19 @@ class FromAppData(BaseEmbed): def __init__(self, options): - super(FromAppData, self).__init__(options) + super().__init__(options) self.symlinks = options.symlink_app_data @classmethod def add_parser_arguments(cls, parser, interpreter, app_data): - super(FromAppData, cls).add_parser_arguments(parser, interpreter, app_data) + super().add_parser_arguments(parser, interpreter, app_data) can_symlink = app_data.transient is False and fs_supports_symlink() + sym = "" if can_symlink else "not supported - " parser.add_argument( "--symlink-app-data", dest="symlink_app_data", action="store_true" if can_symlink else "store_false", - help="{} symlink the python packages from the app-data folder (requires seed pip>=19.3)".format( - "" if can_symlink else "not supported - ", - ), + help=f"{sym} symlink the python packages from the app-data folder (requires seed pip>=19.3)", default=False, ) @@ -64,7 +62,7 @@ def _install(name, wheel): for thread in threads: thread.join() if exceptions: - messages = ["failed to build image {} because:".format(", ".join(exceptions.keys()))] + messages = [f"failed to build image {', '.join(exceptions.keys())} because:"] for value in exceptions.values(): exc_type, exc_value, exc_traceback = value messages.append("".join(traceback.format_exception(exc_type, exc_value, exc_traceback))) @@ -98,11 +96,11 @@ def _get(distribution, version): failure = exception if failure: if isinstance(failure, CalledProcessError): - msg = "failed to download {}".format(distribution) + msg = f"failed to download {distribution}" if version is not None: - msg += " version {}".format(version) - msg += ", pip download exit code {}".format(failure.returncode) - output = failure.output if sys.version_info < (3, 5) else (failure.output + failure.stderr) + msg += f" version {version}" + msg += f", pip download exit code {failure.returncode}" + output = failure.output + failure.stderr if output: msg += "\n" msg += output @@ -124,7 +122,7 @@ def _get(distribution, version): for thread in threads: thread.join() if fail: - raise RuntimeError("seed failed due to failing to download wheels {}".format(", ".join(fail.keys()))) + raise RuntimeError(f"seed failed due to failing to download wheels {', '.join(fail.keys())}") yield name_to_whl def installer_class(self, pip_version_tuple): @@ -134,7 +132,12 @@ def installer_class(self, pip_version_tuple): return SymlinkPipInstall return CopyPipInstall - def __unicode__(self): - base = super(FromAppData, self).__unicode__() - msg = ", via={}, app_data_dir={}".format("symlink" if self.symlinks else "copy", self.app_data) - return base[:-1] + msg + base[-1] + def __repr__(self): + msg = f", via={'symlink' if self.symlinks else 'copy'}, app_data_dir={self.app_data}" + base = super().__repr__() + return f"{base[:-1]}{msg}{base[-1]}" + + +__all__ = [ + "FromAppData", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/seeder.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/seeder.py index c4b34053e..a14e48313 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/seeder.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/seeder.py @@ -1,15 +1,9 @@ -from __future__ import absolute_import, unicode_literals - from abc import ABCMeta, abstractmethod -from ...six import add_metaclass - -@add_metaclass(ABCMeta) -class Seeder(object): +class Seeder(metaclass=ABCMeta): """A seeder will install some seed packages into a virtual environment.""" - # noinspection PyUnusedLocal def __init__(self, options, enabled): """ @@ -38,3 +32,8 @@ def run(self, creator): virtual environment """ raise NotImplementedError + + +__all__ = [ + "Seeder", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/__init__.py index dbffe2e43..c563181fc 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/__init__.py @@ -1,11 +1,9 @@ -from __future__ import absolute_import, unicode_literals - from .acquire import get_wheel, pip_wheel_env_run from .util import Version, Wheel -__all__ = ( +__all__ = [ "get_wheel", "pip_wheel_env_run", "Version", "Wheel", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/acquire.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/acquire.py index 3e6f79c0e..d8e8d1e38 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/acquire.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/acquire.py @@ -1,13 +1,10 @@ """Bootstrap""" -from __future__ import absolute_import, unicode_literals import logging import sys from operator import eq, lt - -from ...util.path import Path -from ...util.six import ensure_str -from ...util.subprocess import Popen, subprocess +from pathlib import Path +from subprocess import PIPE, CalledProcessError, Popen from .bundle import from_bundle from .periodic_update import add_wheel_to_update_log @@ -43,7 +40,7 @@ def get_wheel(distribution, version, for_py_version, search_dirs, download, app_ def download_wheel(distribution, version_spec, for_py_version, search_dirs, app_data, to_folder, env): - to_download = "{}{}".format(distribution, version_spec or "") + to_download = f"{distribution}{version_spec or ''}" logging.debug("download wheel %s %s to %s", to_download, for_py_version, to_folder) cmd = [ sys.executable, @@ -63,15 +60,11 @@ def download_wheel(distribution, version_spec, for_py_version, search_dirs, app_ ] # pip has no interface in python - must be a new sub-process env = pip_wheel_env_run(search_dirs, app_data, env) - process = Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + process = Popen(cmd, env=env, stdout=PIPE, stderr=PIPE, universal_newlines=True) out, err = process.communicate() if process.returncode != 0: - kwargs = {"output": out} - if sys.version_info < (3, 5): - kwargs["output"] += err - else: - kwargs["stderr"] = err - raise subprocess.CalledProcessError(process.returncode, cmd, **kwargs) + kwargs = {"output": out, "stderr": err} + raise CalledProcessError(process.returncode, cmd, **kwargs) result = _find_downloaded_wheel(distribution, version_spec, for_py_version, to_folder, out) logging.debug("downloaded wheel %s", result.name) return result @@ -83,7 +76,7 @@ def _find_downloaded_wheel(distribution, version_spec, for_py_version, to_folder for marker in ("Saved ", "File was already downloaded "): if line.startswith(marker): return Wheel(Path(line[len(marker) :]).absolute()) - # if for some reason the output does not match fallback to latest version with that spec + # if for some reason the output does not match fallback to the latest version with that spec return find_compatible_in_house(distribution, version_spec, for_py_version, to_folder) @@ -104,18 +97,12 @@ def find_compatible_in_house(distribution, version_spec, for_py_version, in_fold def pip_wheel_env_run(search_dirs, app_data, env): - for_py_version = "{}.{}".format(*sys.version_info[0:2]) env = env.copy() - env.update( - { - ensure_str(k): str(v) # python 2 requires these to be string only (non-unicode) - for k, v in {"PIP_USE_WHEEL": "1", "PIP_USER": "0", "PIP_NO_INPUT": "1"}.items() - }, - ) + env.update({"PIP_USE_WHEEL": "1", "PIP_USER": "0", "PIP_NO_INPUT": "1"}) wheel = get_wheel( distribution="pip", version=None, - for_py_version=for_py_version, + for_py_version=f"{sys.version_info.major}.{sys.version_info.minor}", search_dirs=search_dirs, download=False, app_data=app_data, @@ -124,5 +111,12 @@ def pip_wheel_env_run(search_dirs, app_data, env): ) if wheel is None: raise RuntimeError("could not find the embedded pip") - env[str("PYTHONPATH")] = str(wheel.path) + env["PYTHONPATH"] = str(wheel.path) return env + + +__all__ = [ + "get_wheel", + "download_wheel", + "pip_wheel_env_run", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/bundle.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/bundle.py index 39cd3d336..66bbe56df 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/bundle.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/bundle.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - from ..wheels.embed import get_embed_wheel from .periodic_update import periodic_update from .util import Version, Wheel, discover_wheels @@ -15,9 +13,8 @@ def from_bundle(distribution, version, for_py_version, search_dirs, app_data, do if version != Version.embed: # 2. check if we have upgraded embed if app_data.can_update: - wheel = periodic_update( - distribution, of_version, for_py_version, wheel, search_dirs, app_data, do_periodic_update, env - ) + per = do_periodic_update + wheel = periodic_update(distribution, of_version, for_py_version, wheel, search_dirs, app_data, per, env) # 3. acquire from extra search dir found_wheel = from_dir(distribution, of_version, for_py_version, search_dirs) @@ -49,3 +46,9 @@ def from_dir(distribution, version, for_py_version, directories): for wheel in discover_wheels(folder, distribution, version, for_py_version): return wheel return None + + +__all__ = [ + "load_embed_wheel", + "from_bundle", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/__init__.py index e5092b26b..6e85ff5b7 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/__init__.py @@ -1,33 +1,32 @@ -from __future__ import absolute_import, unicode_literals +from pathlib import Path from ..util import Wheel -from ....util.path import Path BUNDLE_FOLDER = Path(__file__).absolute().parent BUNDLE_SUPPORT = { "3.11": { - "pip": "pip-22.0.4-py3-none-any.whl", - "setuptools": "setuptools-62.1.0-py3-none-any.whl", + "pip": "pip-22.2.1-py3-none-any.whl", + "setuptools": "setuptools-63.2.0-py3-none-any.whl", "wheel": "wheel-0.37.1-py2.py3-none-any.whl", }, "3.10": { - "pip": "pip-22.0.4-py3-none-any.whl", - "setuptools": "setuptools-62.1.0-py3-none-any.whl", + "pip": "pip-22.2.1-py3-none-any.whl", + "setuptools": "setuptools-63.2.0-py3-none-any.whl", "wheel": "wheel-0.37.1-py2.py3-none-any.whl", }, "3.9": { - "pip": "pip-22.0.4-py3-none-any.whl", - "setuptools": "setuptools-62.1.0-py3-none-any.whl", + "pip": "pip-22.2.1-py3-none-any.whl", + "setuptools": "setuptools-63.2.0-py3-none-any.whl", "wheel": "wheel-0.37.1-py2.py3-none-any.whl", }, "3.8": { - "pip": "pip-22.0.4-py3-none-any.whl", - "setuptools": "setuptools-62.1.0-py3-none-any.whl", + "pip": "pip-22.2.1-py3-none-any.whl", + "setuptools": "setuptools-63.2.0-py3-none-any.whl", "wheel": "wheel-0.37.1-py2.py3-none-any.whl", }, "3.7": { - "pip": "pip-22.0.4-py3-none-any.whl", - "setuptools": "setuptools-62.1.0-py3-none-any.whl", + "pip": "pip-22.2.1-py3-none-any.whl", + "setuptools": "setuptools-63.2.0-py3-none-any.whl", "wheel": "wheel-0.37.1-py2.py3-none-any.whl", }, "3.6": { @@ -54,9 +53,9 @@ def get_embed_wheel(distribution, for_py_version): return Wheel.from_path(path) -__all__ = ( +__all__ = [ "get_embed_wheel", "BUNDLE_SUPPORT", "MAX", "BUNDLE_FOLDER", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl deleted file mode 100644 index 7ba048e24..000000000 Binary files a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl and /dev/null differ diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/pip-22.2.1-py3-none-any.whl b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/pip-22.2.1-py3-none-any.whl new file mode 100644 index 000000000..4654c0013 Binary files /dev/null and b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/pip-22.2.1-py3-none-any.whl differ diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/setuptools-62.1.0-py3-none-any.whl b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/setuptools-63.2.0-py3-none-any.whl similarity index 60% rename from src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/setuptools-62.1.0-py3-none-any.whl rename to src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/setuptools-63.2.0-py3-none-any.whl index 0a56be0ed..e3b5446eb 100644 Binary files a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/setuptools-62.1.0-py3-none-any.whl and b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/embed/setuptools-63.2.0-py3-none-any.whl differ diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/periodic_update.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/periodic_update.py index 040eadc60..f7efdc09d 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/periodic_update.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/periodic_update.py @@ -2,40 +2,28 @@ Periodically update bundled versions. """ -from __future__ import absolute_import, unicode_literals import json import logging import os import ssl -import subprocess import sys from datetime import datetime, timedelta from itertools import groupby +from pathlib import Path from shutil import copy2 +from subprocess import PIPE, Popen from textwrap import dedent from threading import Thread - -from ....six.moves.urllib.error import URLError -from ....six.moves.urllib.request import urlopen +from urllib.error import URLError +from urllib.request import urlopen from ...app_data import AppDataDiskFolder -from ...info import PY2 -from ...util.path import Path -from ...util.subprocess import CREATE_NO_WINDOW, Popen +from ...util.subprocess import CREATE_NO_WINDOW from ..wheels.embed import BUNDLE_SUPPORT from ..wheels.util import Wheel -if PY2: - # on Python 2 datetime.strptime throws the error below if the import did not trigger on main thread - # Failed to import _strptime because the import lock is held by - try: - import _strptime # noqa - except ImportError: # pragma: no cov - pass # pragma: no cov - - GRACE_PERIOD_CI = timedelta(hours=1) # prevent version switch in the middle of a CI run GRACE_PERIOD_MINOR = timedelta(days=28) UPDATE_PERIOD = timedelta(days=14) @@ -106,7 +94,7 @@ def load_datetime(value): return None if value is None else datetime.strptime(value, DATETIME_FMT) -class NewVersion(object): +class NewVersion: def __init__(self, filename, found_date, release_date, source): self.filename = filename self.found_date = found_date @@ -142,12 +130,9 @@ def use(self, now, ignore_grace_period_minor=False, ignore_grace_period_ci=False return False def __repr__(self): - return "{}(filename={}), found_date={}, release_date={}, source={})".format( - self.__class__.__name__, - self.filename, - self.found_date, - self.release_date, - self.source, + return ( + f"{self.__class__.__name__}(filename={self.filename}), found_date={self.found_date}, " + f"release_date={self.release_date}, source={self.source})" ) def __eq__(self, other): @@ -163,7 +148,7 @@ def wheel(self): return Wheel(Path(self.filename)) -class UpdateLog(object): +class UpdateLog: def __init__(self, started, completed, versions, periodic): self.started = started self.completed = completed @@ -224,8 +209,8 @@ def trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, e .strip() .format(distribution, for_py_version, wheel_path, str(app_data), [str(p) for p in search_dirs], periodic), ] - debug = env.get(str("_VIRTUALENV_PERIODIC_UPDATE_INLINE")) == str("1") - pipe = None if debug else subprocess.PIPE + debug = env.get("_VIRTUALENV_PERIODIC_UPDATE_INLINE") == "1" + pipe = None if debug else PIPE kwargs = {"stdout": pipe, "stderr": pipe} if not debug and sys.platform == "win32": kwargs["creationflags"] = CREATE_NO_WINDOW @@ -233,7 +218,7 @@ def trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, e logging.info( "triggered periodic upgrade of %s%s (for python %s) via background process having PID %d", distribution, - "" if wheel is None else "=={}".format(wheel.version), + "" if wheel is None else f"=={wheel.version}", for_py_version, process.pid, ) @@ -286,7 +271,7 @@ def _run_do_update(app_data, distribution, embed_filename, for_py_version, perio download_time = datetime.now() dest = acquire.download_wheel( distribution=distribution, - version_spec=None if last_version is None else "<{}".format(last_version), + version_spec=None if last_version is None else f"<{last_version}", for_py_version=for_py_version, search_dirs=search_dirs, app_data=app_data, @@ -346,7 +331,7 @@ def _pypi_get_distribution_info_cached(distribution): def _pypi_get_distribution_info(distribution): - content, url = None, "https://pypi.org/pypi/{}/json".format(distribution) + content, url = None, f"https://pypi.org/pypi/{distribution}/json" try: for context in _request_context(): try: @@ -401,20 +386,19 @@ def _run_manual_upgrade(app_data, distribution, for_py_version, env): search_dirs=[], periodic=False, ) - msg = "upgraded %s for python %s in %s {}".format( - "new entries found:\n%s" if versions else "no new versions found", - ) + args = [ distribution, for_py_version, datetime.now() - start, ] if versions: - args.append("\n".join("\t{}".format(v) for v in versions)) - logging.warning(msg, *args) + args.append("\n".join(f"\t{v}" for v in versions)) + ver_update = "new entries found:\n%s" if versions else "no new versions found" + logging.warning(f"upgraded %s for python %s in %s {ver_update}", *args) -__all__ = ( +__all__ = [ "add_wheel_to_update_log", "periodic_update", "do_update", @@ -425,4 +409,4 @@ def _run_manual_upgrade(app_data, distribution, for_py_version, env): "dump_datetime", "trigger_update", "release_date_for_wheel_path", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/util.py b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/util.py index a829a5d48..f09d8736c 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/util.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/seed/wheels/util.py @@ -1,12 +1,8 @@ -from __future__ import absolute_import, unicode_literals - from operator import attrgetter from zipfile import ZipFile -from ...util.six import ensure_text - -class Wheel(object): +class Wheel: def __init__(self, path): # https://www.python.org/dev/peps/pep-0427/#file-name-convention # The wheel filename is {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl @@ -48,8 +44,8 @@ def name(self): return self.path.name def support_py(self, py_version): - name = "{}.dist-info/METADATA".format("-".join(self.path.stem.split("-")[0:2])) - with ZipFile(ensure_text(str(self.path)), "r") as zip_file: + name = f"{'-'.join(self.path.stem.split('-')[0:2])}.dist-info/METADATA" + with ZipFile(str(self.path), "r") as zip_file: metadata = zip_file.read(name).decode("utf-8") marker = "Requires-Python:" requires = next((i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker)), None) @@ -75,7 +71,7 @@ def support_py(self, py_version): return True def __repr__(self): - return "{}({})".format(self.__class__.__name__, self.path) + return f"{self.__class__.__name__}({self.path})" def __str__(self): return str(self.path) @@ -97,10 +93,7 @@ class Version: bundle = "bundle" embed = "embed" #: custom version handlers - non_version = ( - bundle, - embed, - ) + non_version = (bundle, embed) @staticmethod def of_version(value): @@ -108,9 +101,16 @@ def of_version(value): @staticmethod def as_pip_req(distribution, version): - return "{}{}".format(distribution, Version.as_version_spec(version)) + return f"{distribution}{Version.as_version_spec(version)}" @staticmethod def as_version_spec(version): of_version = Version.of_version(version) - return "" if of_version is None else "=={}".format(of_version) + return "" if of_version is None else f"=={of_version}" + + +__all__ = [ + "discover_wheels", + "Version", + "Wheel", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/util/__init__.py index 32d02925b..e69de29bb 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -import sys - -if sys.version_info[0] == 3: - import configparser as ConfigParser -else: - import ConfigParser - - -__all__ = ("ConfigParser",) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/error.py b/src/main/python/pybuilder/_vendor/virtualenv/util/error.py index ac5aa502d..945a25e75 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/error.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/error.py @@ -1,12 +1,11 @@ """Errors""" -from __future__ import absolute_import, unicode_literals class ProcessCallFailed(RuntimeError): """Failed a process call""" def __init__(self, code, out, err, cmd): - super(ProcessCallFailed, self).__init__(code, out, err, cmd) + super().__init__(code, out, err, cmd) self.code = code self.out = out self.err = err diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/lock.py b/src/main/python/pybuilder/_vendor/virtualenv/util/lock.py index c8e7afbf9..88ecef85d 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/lock.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/lock.py @@ -1,16 +1,13 @@ """holds locking functionality that works across processes""" -from __future__ import absolute_import, unicode_literals import logging import os from abc import ABCMeta, abstractmethod from contextlib import contextmanager +from pathlib import Path from threading import Lock, RLock from ...filelock import FileLock, Timeout -from ...six import add_metaclass - -from .path import Path class _CountedFileLock(FileLock): @@ -21,20 +18,20 @@ def __init__(self, lock_file): os.makedirs(parent) except OSError: pass - super(_CountedFileLock, self).__init__(lock_file) + super().__init__(lock_file) self.count = 0 self.thread_safe = RLock() def acquire(self, timeout=None, poll_interval=0.05): with self.thread_safe: if self.count == 0: - super(_CountedFileLock, self).acquire(timeout, poll_interval) + super().acquire(timeout, poll_interval) self.count += 1 def release(self, force=False): with self.thread_safe: if self.count == 1: - super(_CountedFileLock, self).release(force=force) + super().release(force=force) self.count = max(self.count - 1, 0) @@ -42,14 +39,13 @@ def release(self, force=False): _store_lock = Lock() -@add_metaclass(ABCMeta) -class PathLockBase(object): +class PathLockBase(metaclass=ABCMeta): def __init__(self, folder): path = Path(folder) self.path = path.resolve() if path.exists() else path def __repr__(self): - return "{}({})".format(self.__class__.__name__, self.path) + return f"{self.__class__.__name__}({self.path})" def __div__(self, other): return type(self)(self.path / other) @@ -78,11 +74,11 @@ def non_reentrant_lock_for_key(name): class ReentrantFileLock(PathLockBase): def __init__(self, folder): - super(ReentrantFileLock, self).__init__(folder) + super().__init__(folder) self._lock = None def _create_lock(self, name=""): - lock_file = str(self.path / "{}.lock".format(name)) + lock_file = str(self.path / f"{name}.lock") with _store_lock: if lock_file not in _lock_store: _lock_store[lock_file] = _CountedFileLock(lock_file) @@ -144,7 +140,7 @@ def lock_for_key(self, name, no_block=False): @contextmanager def non_reentrant_lock_for_key(self, name): - with _CountedFileLock(str(self.path / "{}.lock".format(name))): + with _CountedFileLock(str(self.path / f"{name}.lock")): yield @@ -164,8 +160,8 @@ def non_reentrant_lock_for_key(self, name): yield -__all__ = ( +__all__ = [ "NoOpFileLock", "ReentrantFileLock", "Timeout", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/path/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/util/path/__init__.py index dc628de83..39a8db7d6 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/path/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/path/__init__.py @@ -1,18 +1,14 @@ -from __future__ import absolute_import, unicode_literals - -from ._pathlib import Path from ._permission import make_exe, set_tree from ._sync import copy, copytree, ensure_dir, safe_delete, symlink from ._win import get_short_path_name -__all__ = ( +__all__ = [ "ensure_dir", "symlink", "copy", "copytree", - "Path", "make_exe", "set_tree", "safe_delete", "get_short_path_name", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_pathlib/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_pathlib/__init__.py deleted file mode 100644 index 06adc26cd..000000000 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_pathlib/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -import sys - -from ..... import six - -if six.PY3: - from pathlib import Path -else: - if sys.platform == "win32": - # workaround for https://github.com/mcmtroffaes/pathlib2/issues/56 - from .via_os_path import Path - else: - from pathlib2 import Path - - -__all__ = ("Path",) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_pathlib/via_os_path.py b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_pathlib/via_os_path.py deleted file mode 100644 index d324f7552..000000000 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_pathlib/via_os_path.py +++ /dev/null @@ -1,151 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -import os -import platform -from contextlib import contextmanager - -from ...six import ensure_str, ensure_text - -IS_PYPY = platform.python_implementation() == "PyPy" - - -class Path(object): - def __init__(self, path): - if isinstance(path, Path): - _path = path._path - else: - _path = ensure_text(path) - if IS_PYPY: - _path = _path.encode("utf-8") - self._path = _path - - def __repr__(self): - return ensure_str("Path({})".format(ensure_text(self._path))) - - def __unicode__(self): - return ensure_text(self._path) - - def __str__(self): - return ensure_str(self._path) - - def __div__(self, other): - if isinstance(other, Path): - right = other._path - else: - right = ensure_text(other) - if IS_PYPY: - right = right.encode("utf-8") - return Path(os.path.join(self._path, right)) - - def __truediv__(self, other): - return self.__div__(other) - - def __eq__(self, other): - return self._path == (other._path if isinstance(other, Path) else None) - - def __ne__(self, other): - return not (self == other) - - def __hash__(self): - return hash(self._path) - - def as_posix(self): - return str(self).replace(os.sep, "/") - - def exists(self): - return os.path.exists(self._path) - - @property - def parent(self): - return Path(os.path.abspath(os.path.join(self._path, os.path.pardir))) - - def resolve(self): - return Path(os.path.realpath(self._path)) - - @property - def name(self): - return os.path.basename(self._path) - - @property - def parts(self): - return self._path.split(os.sep) - - def is_file(self): - return os.path.isfile(self._path) - - def is_dir(self): - return os.path.isdir(self._path) - - def mkdir(self, parents=True, exist_ok=True): - try: - os.makedirs(self._path) - except OSError: - if not exist_ok: - raise - - def read_text(self, encoding="utf-8"): - return self.read_bytes().decode(encoding) - - def read_bytes(self): - with open(self._path, "rb") as file_handler: - return file_handler.read() - - def write_bytes(self, content): - with open(self._path, "wb") as file_handler: - file_handler.write(content) - - def write_text(self, text, encoding="utf-8"): - self.write_bytes(text.encode(encoding)) - - def iterdir(self): - for p in os.listdir(self._path): - yield Path(os.path.join(self._path, p)) - - @property - def suffix(self): - _, ext = os.path.splitext(self.name) - return ext - - @property - def stem(self): - base, _ = os.path.splitext(self.name) - return base - - @contextmanager - def open(self, mode="r"): - with open(self._path, mode) as file_handler: - yield file_handler - - @property - def parents(self): - result = [] - parts = self.parts - for i in range(len(parts) - 1): - result.append(Path(os.sep.join(parts[0 : i + 1]))) - return result[::-1] - - def unlink(self): - os.remove(self._path) - - def with_name(self, name): - return self.parent / name - - def is_symlink(self): - return os.path.islink(self._path) - - def relative_to(self, other): - if not self._path.startswith(other._path): - raise ValueError("{} does not start with {}".format(self._path, other._path)) - return Path(os.sep.join(self.parts[len(other.parts) :])) - - def stat(self): - return os.stat(self._path) - - def chmod(self, mode): - os.chmod(self._path, mode) - - def absolute(self): - return Path(os.path.abspath(self._path)) - - -__all__ = ("Path",) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_permission.py b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_permission.py index 4679a94c5..ca9231405 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_permission.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_permission.py @@ -1,10 +1,6 @@ -from __future__ import absolute_import, unicode_literals - import os from stat import S_IXGRP, S_IXOTH, S_IXUSR -from ..six import ensure_text - def make_exe(filename): original_mode = filename.stat().st_mode @@ -21,7 +17,7 @@ def make_exe(filename): def set_tree(folder, stat): - for root, _, files in os.walk(ensure_text(str(folder))): + for root, _, files in os.walk(str(folder)): for filename in files: os.chmod(os.path.join(root, filename), stat) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_sync.py b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_sync.py index a048a6f88..10c793d61 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_sync.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_sync.py @@ -1,33 +1,18 @@ -from __future__ import absolute_import, unicode_literals - import logging import os import shutil from stat import S_IWUSR -from ....six import PY2 - -from ...info import IS_CPYTHON, IS_WIN -from ..six import ensure_text - -if PY2 and IS_CPYTHON and IS_WIN: # CPython2 on Windows supports unicode paths if passed as unicode - - def norm(src): - return ensure_text(str(src)) - -else: - norm = str - def ensure_dir(path): if not path.exists(): - logging.debug("create folder %s", ensure_text(str(path))) - os.makedirs(norm(path)) + logging.debug("create folder %s", str(path)) + os.makedirs(str(path)) def ensure_safe_to_do(src, dest): if src == dest: - raise ValueError("source and destination is the same {}".format(src)) + raise ValueError(f"source and destination is the same {src}") if not dest.exists(): return if dest.is_dir() and not dest.is_symlink(): @@ -49,7 +34,7 @@ def copy(src, dest): is_dir = src.is_dir() method = copytree if is_dir else shutil.copy logging.debug("copy %s", _Debug(src, dest)) - method(norm(src), norm(dest)) + method(str(src), str(dest)) def copytree(src, dest): @@ -71,27 +56,23 @@ def onerror(func, path, exc_info): else: raise - shutil.rmtree(ensure_text(str(dest)), ignore_errors=True, onerror=onerror) + shutil.rmtree(str(dest), ignore_errors=True, onerror=onerror) -class _Debug(object): +class _Debug: def __init__(self, src, dest): self.src = src self.dest = dest def __str__(self): - return "{}{} to {}".format( - "directory " if self.src.is_dir() else "", - ensure_text(str(self.src)), - ensure_text(str(self.dest)), - ) + return f"{'directory ' if self.src.is_dir() else ''}{str(self.src)} to {str(self.dest)}" -__all__ = ( +__all__ = [ "ensure_dir", "symlink", "copy", "symlink", "copytree", "safe_delete", -) +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_win.py b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_win.py index 02e16d07e..8dd81c915 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/path/_win.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/path/_win.py @@ -17,3 +17,8 @@ def get_short_path_name(long_name): return output_buf.value else: output_buf_size = needed + + +__all__ = [ + "get_short_path_name", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/six.py b/src/main/python/pybuilder/_vendor/virtualenv/util/six.py deleted file mode 100644 index a6e03d0fb..000000000 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/six.py +++ /dev/null @@ -1,50 +0,0 @@ -"""Backward compatibility layer with older version of six. - -This is used to avoid virtualenv requiring a version of six newer than what -the system may have. -""" -from __future__ import absolute_import - -from ...six import PY2, PY3, binary_type, text_type - -try: - from ...six import ensure_text -except ImportError: - - def ensure_text(s, encoding="utf-8", errors="strict"): - """Coerce *s* to six.text_type. - For Python 2: - - `unicode` -> `unicode` - - `str` -> `unicode` - For Python 3: - - `str` -> `str` - - `bytes` -> decoded to `str` - """ - if isinstance(s, binary_type): - return s.decode(encoding, errors) - elif isinstance(s, text_type): - return s - else: - raise TypeError("not expecting type '%s'" % type(s)) - - -try: - from ...six import ensure_str -except ImportError: - - def ensure_str(s, encoding="utf-8", errors="strict"): - """Coerce *s* to `str`. - For Python 2: - - `unicode` -> encoded to `str` - - `str` -> `str` - For Python 3: - - `str` -> `str` - - `bytes` -> decoded to `str` - """ - if not isinstance(s, (text_type, binary_type)): - raise TypeError("not expecting type '%s'" % type(s)) - if PY2 and isinstance(s, text_type): - s = s.encode(encoding, errors) - elif PY3 and isinstance(s, binary_type): - s = s.decode(encoding, errors) - return s diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/__init__.py b/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/__init__.py index 443eae932..bc6ec4d3e 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/__init__.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/__init__.py @@ -1,24 +1,11 @@ -from __future__ import absolute_import, unicode_literals - import subprocess -import sys - -from .... import six - -if six.PY2 and sys.platform == "win32": - from . import _win_subprocess - - Popen = _win_subprocess.Popen -else: - Popen = subprocess.Popen - CREATE_NO_WINDOW = 0x80000000 def run_cmd(cmd): try: - process = Popen( + process = subprocess.Popen( cmd, universal_newlines=True, stdin=subprocess.PIPE, @@ -27,14 +14,14 @@ def run_cmd(cmd): ) out, err = process.communicate() # input disabled code = process.returncode - except OSError as os_error: - code, out, err = os_error.errno, "", os_error.strerror + except OSError as error: + code, out, err = error.errno, "", error.strerror + if code == 2 and "file" in err: + err = str(error) # FileNotFoundError in Python >= 3.3 return code, out, err __all__ = ( - "subprocess", - "Popen", "run_cmd", "CREATE_NO_WINDOW", ) diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/_win_subprocess.py b/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/_win_subprocess.py deleted file mode 100644 index ce531979a..000000000 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/subprocess/_win_subprocess.py +++ /dev/null @@ -1,176 +0,0 @@ -# flake8: noqa -# fmt: off -## issue: https://bugs.python.org/issue19264 - -import ctypes -import os -import platform -import subprocess -from ctypes import Structure, WinError, byref, c_char_p, c_void_p, c_wchar, c_wchar_p, sizeof, windll -from ctypes.wintypes import BOOL, BYTE, DWORD, HANDLE, LPCWSTR, LPVOID, LPWSTR, WORD - -import _subprocess - -## -## Types -## - -CREATE_UNICODE_ENVIRONMENT = 0x00000400 -LPCTSTR = c_char_p -LPTSTR = c_wchar_p -LPSECURITY_ATTRIBUTES = c_void_p -LPBYTE = ctypes.POINTER(BYTE) - -class STARTUPINFOW(Structure): - _fields_ = [ - ("cb", DWORD), ("lpReserved", LPWSTR), - ("lpDesktop", LPWSTR), ("lpTitle", LPWSTR), - ("dwX", DWORD), ("dwY", DWORD), - ("dwXSize", DWORD), ("dwYSize", DWORD), - ("dwXCountChars", DWORD), ("dwYCountChars", DWORD), - ("dwFillAtrribute", DWORD), ("dwFlags", DWORD), - ("wShowWindow", WORD), ("cbReserved2", WORD), - ("lpReserved2", LPBYTE), ("hStdInput", HANDLE), - ("hStdOutput", HANDLE), ("hStdError", HANDLE), - ] - -LPSTARTUPINFOW = ctypes.POINTER(STARTUPINFOW) - - -class PROCESS_INFORMATION(Structure): - _fields_ = [ - ("hProcess", HANDLE), ("hThread", HANDLE), - ("dwProcessId", DWORD), ("dwThreadId", DWORD), - ] - -LPPROCESS_INFORMATION = ctypes.POINTER(PROCESS_INFORMATION) - - -class DUMMY_HANDLE(ctypes.c_void_p): - - def __init__(self, *a, **kw): - super(DUMMY_HANDLE, self).__init__(*a, **kw) - self.closed = False - - def Close(self): - if not self.closed: - windll.kernel32.CloseHandle(self) - self.closed = True - - def __int__(self): - return self.value - - -CreateProcessW = windll.kernel32.CreateProcessW -CreateProcessW.argtypes = [ - LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, - LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, - LPSTARTUPINFOW, LPPROCESS_INFORMATION, -] -CreateProcessW.restype = BOOL - - -## -## Patched functions/classes -## - -def CreateProcess( - executable, args, _p_attr, _t_attr, - inherit_handles, creation_flags, env, cwd, - startup_info, -): - """Create a process supporting unicode executable and args for win32 - - Python implementation of CreateProcess using CreateProcessW for Win32 - - """ - - si = STARTUPINFOW( - dwFlags=startup_info.dwFlags, - wShowWindow=startup_info.wShowWindow, - cb=sizeof(STARTUPINFOW), - ## XXXvlab: not sure of the casting here to ints. - hStdInput=startup_info.hStdInput if startup_info.hStdInput is None else int(startup_info.hStdInput), - hStdOutput=startup_info.hStdOutput if startup_info.hStdOutput is None else int(startup_info.hStdOutput), - hStdError=startup_info.hStdError if startup_info.hStdError is None else int(startup_info.hStdError), - ) - - wenv = None - if env is not None: - ## LPCWSTR seems to be c_wchar_p, so let's say CWSTR is c_wchar - env = ( - unicode("").join([ - unicode("%s=%s\0") % (k, v) - for k, v in env.items() - ]) - ) + unicode("\0") - wenv = (c_wchar * len(env))() - wenv.value = env - - wcwd = None - if cwd is not None: - wcwd = unicode(cwd) - - pi = PROCESS_INFORMATION() - creation_flags |= CREATE_UNICODE_ENVIRONMENT - - if CreateProcessW( - executable, args, None, None, - inherit_handles, creation_flags, - wenv, wcwd, byref(si), byref(pi), - ): - return ( - DUMMY_HANDLE(pi.hProcess), DUMMY_HANDLE(pi.hThread), - pi.dwProcessId, pi.dwThreadId, - ) - raise WinError() - - -class Popen(subprocess.Popen): - """This superseeds Popen and corrects a bug in cPython 2.7 implem""" - - def _execute_child( - self, args, executable, preexec_fn, close_fds, - cwd, env, universal_newlines, - startupinfo, creationflags, shell, to_close, - p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite, - ): - """Code from part of _execute_child from Python 2.7 (9fbb65e) - - There are only 2 little changes concerning the construction of - the the final string in shell mode: we preempt the creation of - the command string when shell is True, because original function - will try to encode unicode args which we want to avoid to be able to - sending it as-is to ``CreateProcess``. - - """ - if startupinfo is None: - startupinfo = subprocess.STARTUPINFO() - if not isinstance(args, subprocess.types.StringTypes): - args = [i if isinstance(i, bytes) else i.encode('utf-8') for i in args] - args = subprocess.list2cmdline(args) - if platform.python_implementation() == "CPython": - args = args.decode('utf-8') - startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW - startupinfo.wShowWindow = _subprocess.SW_HIDE - env = os.environ if env is None else env - comspec = env.get("COMSPEC", unicode("cmd.exe")) - if ( - _subprocess.GetVersion() >= 0x80000000 or - os.path.basename(comspec).lower() == "command.com" - ): - w9xpopen = self._find_w9xpopen() - args = unicode('"%s" %s') % (w9xpopen, args) - creationflags |= _subprocess.CREATE_NEW_CONSOLE - - super(Popen, self)._execute_child( - args, executable, - preexec_fn, close_fds, cwd, env, universal_newlines, - startupinfo, creationflags, False, to_close, p2cread, - p2cwrite, c2pread, c2pwrite, errread, errwrite, - ) - -_subprocess.CreateProcess = CreateProcess -# fmt: on diff --git a/src/main/python/pybuilder/_vendor/virtualenv/util/zipapp.py b/src/main/python/pybuilder/_vendor/virtualenv/util/zipapp.py index 68b1a2416..7bc1ecca2 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/util/zipapp.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/util/zipapp.py @@ -1,11 +1,8 @@ -from __future__ import absolute_import, unicode_literals - import logging import os import zipfile from ..info import IS_WIN, ROOT -from .six import ensure_text def read(full_path): @@ -21,7 +18,7 @@ def extract(full_path, dest): with zipfile.ZipFile(ROOT, "r") as zip_file: info = zip_file.getinfo(sub_file) info.filename = dest.name - zip_file.extract(info, ensure_text(str(dest.parent))) + zip_file.extract(info, str(dest.parent)) def _get_path_within_zip(full_path): @@ -31,3 +28,9 @@ def _get_path_within_zip(full_path): # paths are always UNIX separators, even on Windows, though __file__ still follows platform default sub_file = sub_file.replace(os.sep, "/") return sub_file + + +__all__ = [ + "read", + "extract", +] diff --git a/src/main/python/pybuilder/_vendor/virtualenv/version.py b/src/main/python/pybuilder/_vendor/virtualenv/version.py index 86283dcee..e9d8d897e 100644 --- a/src/main/python/pybuilder/_vendor/virtualenv/version.py +++ b/src/main/python/pybuilder/_vendor/virtualenv/version.py @@ -1,3 +1,3 @@ from __future__ import unicode_literals -__version__ = "20.14.1" +__version__ = "20.16.2"