From 7520f6983bc82a5f2a72bbe5bc869f954ef95a9f Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Fri, 1 Sep 2023 05:15:36 -0400 Subject: [PATCH] Top level Pipfile sys_platform markers should be transitive (#5892) * Top level Pipfile sys_platform markers should be transitive * Add platform_machine top level specifier * Handle case where markers is None * more safety checks * relock on python 3.7 --------- Co-authored-by: Christian Clauss --- Pipfile | 15 ++-- Pipfile.lock | 156 ++++----------------------------------- news/5892.feature.rst | 1 + pipenv/utils/markers.py | 2 + pipenv/utils/resolver.py | 45 +++++++++++ 5 files changed, 73 insertions(+), 146 deletions(-) create mode 100644 news/5892.feature.rst diff --git a/Pipfile b/Pipfile index 515d7ab1ab..8c1b89f573 100644 --- a/Pipfile +++ b/Pipfile @@ -10,17 +10,20 @@ sphinx-click = "==4.*" sphinxcontrib-spelling = "==7.*" click = "==8.0.3" pypiserver = "==1.*" -stdeb = {version="*", markers="sys_platform == 'linux'"} +stdeb = {version="*", sys_platform = "== 'linux'"} zipp = {version = "==3.6.0", markers = "python_version < '3.10'"} pre-commit = "==2.*" -atomicwrites = {version = "*", markers="sys_platform == 'win32'"} +atomicwrites = {version = "*", sys_platform = "== 'win32'"} pytest-cov = "==3.*" +pluggy = "==1.2.0" # Can be removed from Pipfile when dropping py 3.7 +filelock = "==3.12.2" # Can be removed from Pipfile when dropping py 3.7 +coverage = "==7.2.7" # Can be removed from Pipfile when dropping py 3.7 typing-extensions = "==4.*" -waitress = {version = "*", markers="sys_platform == 'win32'"} -gunicorn = {version = "*", markers="sys_platform == 'linux'"} +waitress = {version = "*", sys_platform = "== 'win32'"} +gunicorn = {version = "*", sys_platform = "== 'linux'"} parse = "*" -importlib-metadata = {version = "*", markers="python_version < '3.8'"} -colorama= {version = "*", markers="sys_platform == 'win32'"} +importlib-metadata = {version = "*"} +colorama= {version = "*", sys_platform = "== 'win32'"} myst-parser = {extras = ["linkify"], version = "*"} invoke = "==2.0.0" exceptiongroup = "==1.1.0" diff --git a/Pipfile.lock b/Pipfile.lock index 4a82ff4439..b5b4957137 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "262864edb3f18af99a16b3a0d7b9d06fe99a0b86d52486f66a9ac82d0460755f" + "sha256": "8a84150804ee1b1aa65d180190c3795476aea5d3a49b530663ce52a03b5ca8c1" }, "pipfile-spec": 6, "requires": {}, @@ -43,7 +43,6 @@ "hashes": [ "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11" ], - "markers": "sys_platform == 'win32'", "version": "==1.4.1" }, "attrs": { @@ -67,7 +66,6 @@ "sha256:492bbc69dca35d12daac71c4db1bfff0c876c00ef4a2ffacce226d4638eb72da", "sha256:bd2520ca0d9d7d12694a53d44ac482d181b4ec1888909b035a3dbf40d0f57d4a" ], - "markers": "python_full_version >= '3.6.0'", "version": "==4.12.2" }, "black": { @@ -98,7 +96,6 @@ "sha256:ec751418022185b0c1bb7d7736e6933d40bbb14c14a0abcf9123d1b159f98dd4", "sha256:f0bd2f4a58d6666500542b26354978218a9babcdc972722f4bf90779524515f3" ], - "markers": "python_version >= '3.7'", "version": "==23.3.0" }, "bleach": { @@ -126,75 +123,6 @@ "markers": "python_version >= '3.6'", "version": "==2023.7.22" }, - "cffi": { - "hashes": [ - "sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5", - "sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef", - "sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104", - "sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426", - "sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405", - "sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375", - "sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a", - "sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e", - "sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc", - "sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf", - "sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185", - "sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497", - "sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3", - "sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35", - "sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c", - "sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83", - "sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21", - "sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca", - "sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984", - "sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac", - "sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd", - "sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee", - "sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a", - "sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2", - "sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192", - "sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7", - "sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585", - "sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f", - "sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e", - "sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27", - "sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b", - "sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e", - "sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e", - "sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d", - "sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c", - "sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415", - "sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82", - "sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02", - "sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314", - "sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325", - "sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c", - "sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3", - "sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914", - "sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045", - "sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d", - "sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9", - "sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5", - "sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2", - "sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c", - "sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3", - "sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2", - "sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8", - "sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d", - "sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d", - "sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9", - "sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162", - "sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76", - "sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4", - "sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e", - "sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9", - "sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6", - "sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b", - "sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01", - "sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0" - ], - "version": "==1.15.1" - }, "cfgv": { "hashes": [ "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426", @@ -306,13 +234,10 @@ "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" ], - "markers": "sys_platform == 'win32'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6' and sys_platform == 'win32'", "version": "==0.4.6" }, "coverage": { - "extras": [ - "toml" - ], "hashes": [ "sha256:06a9a2be0b5b576c3f18f1a241f0473575c4a26021b52b2a85263a00f034d51f", "sha256:06fb182e69f33f6cd1d39a6c597294cff3143554b64b9825d1dc69d18cc2fff2", @@ -375,38 +300,10 @@ "sha256:f75f7168ab25dd93110c8a8117a22450c19976afbc44234cbf71481094c1b850", "sha256:fdec9e8cbf13a5bf63290fc6013d216a4c7232efb51548594ca3631a7f13c3a3" ], + "index": "pypi", "markers": "python_version >= '3.7'", "version": "==7.2.7" }, - "cryptography": { - "hashes": [ - "sha256:0d09fb5356f975974dbcb595ad2d178305e5050656affb7890a1583f5e02a306", - "sha256:23c2d778cf829f7d0ae180600b17e9fceea3c2ef8b31a99e3c694cbbf3a24b84", - "sha256:3fb248989b6363906827284cd20cca63bb1a757e0a2864d4c1682a985e3dca47", - "sha256:41d7aa7cdfded09b3d73a47f429c298e80796c8e825ddfadc84c8a7f12df212d", - "sha256:42cb413e01a5d36da9929baa9d70ca90d90b969269e5a12d39c1e0d475010116", - "sha256:4c2f0d35703d61002a2bbdcf15548ebb701cfdd83cdc12471d2bae80878a4207", - "sha256:4fd871184321100fb400d759ad0cddddf284c4b696568204d281c902fc7b0d81", - "sha256:5259cb659aa43005eb55a0e4ff2c825ca111a0da1814202c64d28a985d33b087", - "sha256:57a51b89f954f216a81c9d057bf1a24e2f36e764a1ca9a501a6964eb4a6800dd", - "sha256:652627a055cb52a84f8c448185922241dd5217443ca194d5739b44612c5e6507", - "sha256:67e120e9a577c64fe1f611e53b30b3e69744e5910ff3b6e97e935aeb96005858", - "sha256:6af1c6387c531cd364b72c28daa29232162010d952ceb7e5ca8e2827526aceae", - "sha256:6d192741113ef5e30d89dcb5b956ef4e1578f304708701b8b73d38e3e1461f34", - "sha256:7efe8041897fe7a50863e51b77789b657a133c75c3b094e51b5e4b5cec7bf906", - "sha256:84537453d57f55a50a5b6835622ee405816999a7113267739a1b4581f83535bd", - "sha256:8f09daa483aedea50d249ef98ed500569841d6498aa9c9f4b0531b9964658922", - "sha256:95dd7f261bb76948b52a5330ba5202b91a26fbac13ad0e9fc8a3ac04752058c7", - "sha256:a74fbcdb2a0d46fe00504f571a2a540532f4c188e6ccf26f1f178480117b33c4", - "sha256:a983e441a00a9d57a4d7c91b3116a37ae602907a7618b882c8013b5762e80574", - "sha256:ab8de0d091acbf778f74286f4989cf3d1528336af1b59f3e5d2ebca8b5fe49e1", - "sha256:aeb57c421b34af8f9fe830e1955bf493a86a7996cc1338fe41b30047d16e962c", - "sha256:ce785cf81a7bdade534297ef9e490ddff800d956625020ab2ec2780a556c313e", - "sha256:d0d651aa754ef58d75cec6edfbd21259d93810b73f6ec246436a21b7841908de" - ], - "markers": "python_version >= '3.7'", - "version": "==41.0.3" - }, "distlib": { "hashes": [ "sha256:2e24928bc811348f0feb63014e97aaae3037f2cf48712d51ae61df7fd6075057", @@ -444,6 +341,7 @@ "sha256:002740518d8aa59a26b0c76e10fb8c6e15eae825d34b6fdf670333fd7b938d81", "sha256:cbb791cdea2a72f23da6ac5b5269ab0a0d161e9ef0100e653b69049a7706d1ec" ], + "index": "pypi", "markers": "python_version >= '3.7'", "version": "==3.12.2" }, @@ -452,7 +350,6 @@ "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b", "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==3.9.2" }, "flaky": { @@ -460,7 +357,6 @@ "sha256:3ad100780721a1911f57a165809b7ea265a7863305acb66708220820caf8aa0d", "sha256:d6eda73cab5ae7364504b7c44670f70abed9e75f77dd116352f662817592ec9c" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==3.7.0" }, "gunicorn": { @@ -468,7 +364,7 @@ "sha256:3213aa5e8c24949e792bcacfc176fef362e7aac80b76c56f6b5122bf350722f0", "sha256:88ec8bff1d634f98e61b9f65bc4bf3cd918a90806c6f5c48bc5603849ec81033" ], - "markers": "sys_platform == 'linux'", + "markers": "python_version >= '3.5' and sys_platform == 'linux'", "version": "==21.2.0" }, "identify": { @@ -500,7 +396,7 @@ "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4", "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5" ], - "markers": "python_version < '3.8'", + "markers": "python_version >= '3.7'", "version": "==6.7.0" }, "importlib-resources": { @@ -543,14 +439,6 @@ "markers": "python_version >= '3.7'", "version": "==3.2.3" }, - "jeepney": { - "hashes": [ - "sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806", - "sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755" - ], - "markers": "sys_platform == 'linux'", - "version": "==0.8.0" - }, "jinja2": { "hashes": [ "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852", @@ -666,7 +554,6 @@ "sha256:18c694e5ae8a208cdb3d2c20a993ca1a7b0efa258c247a1e565150f477f83744", "sha256:5e96aad5ccda4718e0a229ed94b2024df75cc2d55575ba5762d31f5767b8767d" ], - "markers": "python_version >= '3.6'", "version": "==5.1.0" }, "more-itertools": { @@ -725,7 +612,6 @@ "sha256:c66d3347a4858643875ef959d8ba7a269d5964bfb690b0dd998b8f39da930be2", "sha256:d4a3dbb93c53373ee9a0ba055e4858c44169b204b912e49d003ead95db9a9bca" ], - "markers": "python_version >= '3.7'", "version": "==0.4" }, "pathspec": { @@ -773,6 +659,7 @@ "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849", "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3" ], + "index": "pypi", "markers": "python_version >= '3.7'", "version": "==1.2.0" }, @@ -793,13 +680,6 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.7.0" }, - "pycparser": { - "hashes": [ - "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9", - "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206" - ], - "version": "==2.21" - }, "pyenchant": { "hashes": [ "sha256:0314d162b7af83adc500f5aff850c91466129363ca8c4d79a8b8d99253346204", @@ -865,7 +745,6 @@ "sha256:c07ca07404c612f8abbe22294b23c368e2e5104b521c1790195561f37e1ac3d9", "sha256:f6f50101443ce70ad325ceb4473c4255e9d74e3c7cd0ef827309dfa4c0d975c6" ], - "markers": "python_version >= '3.6'", "version": "==2.1.0" }, "pytest-xdist": { @@ -873,7 +752,6 @@ "sha256:d5ee0520eb1b7bcca50a60a518ab7a7707992812c578198f8b44fdfac78e8c93", "sha256:ff9daa7793569e6a68544850fd3927cd257cc03a7ef76c95e86915355e82b5f2" ], - "markers": "python_version >= '3.7'", "version": "==3.3.1" }, "pytz": { @@ -884,6 +762,14 @@ "index": "pypi", "version": "==2023.3" }, + "pywin32-ctypes": { + "hashes": [ + "sha256:3426e063bdd5fd4df74a14fa3cf80a0b42845a87e1d1e81f6549f9daec593a60", + "sha256:bf490a1a709baf35d688fe0ecf980ed4de11d2b3e37b51e5442587a75d9957e7" + ], + "markers": "sys_platform == 'win32'", + "version": "==0.2.2" + }, "pyyaml": { "hashes": [ "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5", @@ -981,14 +867,6 @@ "markers": "python_full_version >= '3.7.0'", "version": "==13.5.2" }, - "secretstorage": { - "hashes": [ - "sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77", - "sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99" - ], - "markers": "sys_platform == 'linux'", - "version": "==3.3.3" - }, "setuptools": { "hashes": [ "sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f", @@ -1099,7 +977,6 @@ "hashes": [ "sha256:08c22c9c03b28a140fe3ec5064b53a5288279f22e596ca06b0be698d50c93cf2" ], - "markers": "sys_platform == 'linux'", "version": "==0.10.0" }, "tomli": { @@ -1116,7 +993,6 @@ "sha256:da552f29192b3c2b04d630133f194c98e9f14f0558669d427708e203fea4d0a5", "sha256:fc29bd5ab4727c8dacfbe636f7fb5dc53b99805b62da1c96b214836159ff70c1" ], - "markers": "python_version >= '3.7'", "version": "==23.6.0" }, "twine": { @@ -1213,7 +1089,7 @@ "sha256:7500c9625927c8ec60f54377d590f67b30c8e70ef4b8894214ac6e4cad233d2a", "sha256:780a4082c5fbc0fde6a2fcfe5e26e6efc1e8f425730863c04085769781f51eba" ], - "markers": "sys_platform == 'win32'", + "markers": "python_full_version >= '3.7.0' and sys_platform == 'win32'", "version": "==2.1.2" }, "webencodings": { diff --git a/news/5892.feature.rst b/news/5892.feature.rst new file mode 100644 index 0000000000..80b0e512ed --- /dev/null +++ b/news/5892.feature.rst @@ -0,0 +1 @@ +Top level Pipfile sys_platform markers should be transitive; adds top level platform_machine entries that are also transitive. Marker entries continue to operate the same as before. diff --git a/pipenv/utils/markers.py b/pipenv/utils/markers.py index dcb3384a5b..21c1c8a5c8 100644 --- a/pipenv/utils/markers.py +++ b/pipenv/utils/markers.py @@ -54,6 +54,8 @@ def from_pipfile(cls, name, pipfile): marker_strings.append(pipfile.get("markers")) if pipfile.get("sys_platform"): marker_strings.append(f"sys_platform '{pipfile['sys_platform']}'") + if pipfile.get("platform_machine"): + marker_strings.append(f"platform_machine '{pipfile['platform_machine']}'") markers = set() for marker in marker_strings: markers.add(marker) diff --git a/pipenv/utils/resolver.py b/pipenv/utils/resolver.py index bcdef0ccd3..83964d7d5b 100644 --- a/pipenv/utils/resolver.py +++ b/pipenv/utils/resolver.py @@ -447,9 +447,49 @@ def resolve(self): self.resolved_tree.update(self.results) return self.resolved_tree + def _get_pipfile_markers(self, pipfile_entry): + sys_platform = pipfile_entry.get("sys_platform") + platform_machine = pipfile_entry.get("platform_machine") + markers = pipfile_entry.get("markers") + + if sys_platform: + sys_platform = f"sys_platform {sys_platform}" + if platform_machine: + platform_machine = f"platform_machine {platform_machine}" + + combined_markers = [ + f"({marker})" + for marker in (sys_platform, markers, platform_machine) + if marker + ] + + return " and ".join(combined_markers).strip() + + def _fold_markers(self, dependency_tree, install_req): + comes_from = dependency_tree[install_req.name] + + if comes_from == "Pipfile": + pipfile_entry = self.pipfile_entries.get(install_req.name) + if pipfile_entry and isinstance(pipfile_entry, dict): + return self._get_pipfile_markers(pipfile_entry) + else: + markers = self._fold_markers(dependency_tree, comes_from) + if markers: + self.markers_lookup[install_req.name] = markers + return markers + def resolve_constraints(self): from .markers import marker_from_specifier + # Build mapping of where package originates from + comes_from = {} + for result in self.resolved_tree: + if isinstance(result.comes_from, InstallRequirement): + comes_from[result.name] = result.comes_from + else: + comes_from[result.name] = "Pipfile" + + # Build up the results tree with markers new_tree = set() for result in self.resolved_tree: if result.markers: @@ -475,6 +515,11 @@ def resolve_constraints(self): err=True, ) new_tree.add(result) + + # Fold markers + for result in new_tree: + self._fold_markers(comes_from, result) + self.resolved_tree = new_tree def collect_hashes(self, ireq):