From 96804893d7179fb16fa3b1a060b9bd19b9222d07 Mon Sep 17 00:00:00 2001 From: qlan Date: Tue, 31 Jul 2018 17:32:54 -0700 Subject: [PATCH] add default configuration to ivy file of wheels which have metadata in json file --- .../distribution/WheelsPackage.groovy | 1 + .../distribution/WheelsPackageTest.groovy | 28 +++++++++++++----- .../importer/ivy/IvyFileWriterTest.groovy | 2 +- .../deps/pywin32-223-cp27-cp27m-win_amd64.whl | Bin 0 -> 2342 bytes version.properties | 2 +- 5 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 pivy-importer/src/test/resources/deps/pywin32-223-cp27-cp27m-win_amd64.whl diff --git a/pivy-importer/src/main/groovy/com/linkedin/python/importer/distribution/WheelsPackage.groovy b/pivy-importer/src/main/groovy/com/linkedin/python/importer/distribution/WheelsPackage.groovy index db32be38..74d89853 100644 --- a/pivy-importer/src/main/groovy/com/linkedin/python/importer/distribution/WheelsPackage.groovy +++ b/pivy-importer/src/main/groovy/com/linkedin/python/importer/distribution/WheelsPackage.groovy @@ -87,6 +87,7 @@ class WheelsPackage extends PythonPackage { } Map> runtimeRequiresMap = [:] + runtimeRequiresMap['default'] = [] def runRequires = jsonMetadata["run_requires"] def metaRequires = jsonMetadata["meta_requires"] diff --git a/pivy-importer/src/test/groovy/com/linkedin/python/importer/distribution/WheelsPackageTest.groovy b/pivy-importer/src/test/groovy/com/linkedin/python/importer/distribution/WheelsPackageTest.groovy index 354db9a2..3e05cea0 100644 --- a/pivy-importer/src/test/groovy/com/linkedin/python/importer/distribution/WheelsPackageTest.groovy +++ b/pivy-importer/src/test/groovy/com/linkedin/python/importer/distribution/WheelsPackageTest.groovy @@ -21,31 +21,43 @@ import spock.lang.Specification class WheelsPackageTest extends Specification { private File testDirectory - private WheelsPackage testWheelsPackage + private WheelsPackage testWheelsPackageDjango + private WheelsPackage testWheelsPackagePywin def setup() { testDirectory = new File(getClass().getClassLoader().getResource("deps").getFile()) - File testPackageFile = new File(testDirectory, "Django-2.0.6-py3-none-any.whl") + File testPackageFileDjango = new File(testDirectory, "Django-2.0.6-py3-none-any.whl") + File testPackageFilePywin32 = new File(testDirectory, "pywin32-223-cp27-cp27m-win_amd64.whl") DependencySubstitution testDependencySubstitution = new DependencySubstitution([:], [:]) PypiApiCache testPypiApiCache = new PypiApiCache() - testWheelsPackage = new WheelsPackage("Django", "2.0.6", testPackageFile, + testWheelsPackageDjango = new WheelsPackage("Django", "2.0.6", testPackageFileDjango, testPypiApiCache, testDependencySubstitution) + + testWheelsPackagePywin = new WheelsPackage("pywin32", "223", testPackageFilePywin32, testPypiApiCache, testDependencySubstitution) } - def "test getting runtime requires from metadata Json file"() { + def "test getting runtime requires from metadata Json file for wheel package which has runtime dependencies"() { when: - def actualResult = testWheelsPackage.getRuntimeRequiresFromMetadataJson() - String expectedResultString = "[argon2:[argon2-cffi (>=16.1.0)], bcrypt:[bcrypt], default:[pytz]]" + def actualResult = testWheelsPackageDjango.getRuntimeRequiresFromMetadataJson() + String expectedResultString = "[default:[pytz], argon2:[argon2-cffi (>=16.1.0)], bcrypt:[bcrypt]]" then: actualResult.toString() == expectedResultString } - def "test getting metadata text file content"() { + def "test getting metadata text file content for wheel package which has runtime dependencies"() { when: - String actualResult = testWheelsPackage.getMetadataText() + String actualResult = testWheelsPackageDjango.getMetadataText() String expectedResult = new File(testDirectory, "Django-2.0.6-py3-none-any-METADATA").getText() then: actualResult == expectedResult } + + def "test getting runtime requires from metadata Json file for wheel package which has no runtime dependencies"() { + when: + def actualResult = testWheelsPackagePywin.getRuntimeRequiresFromMetadataJson() + String expectedResultString = "[default:[]]" + then: + actualResult.toString() == expectedResultString + } } diff --git a/pivy-importer/src/test/groovy/com/linkedin/python/importer/ivy/IvyFileWriterTest.groovy b/pivy-importer/src/test/groovy/com/linkedin/python/importer/ivy/IvyFileWriterTest.groovy index 562608e7..6ceda362 100644 --- a/pivy-importer/src/test/groovy/com/linkedin/python/importer/ivy/IvyFileWriterTest.groovy +++ b/pivy-importer/src/test/groovy/com/linkedin/python/importer/ivy/IvyFileWriterTest.groovy @@ -30,7 +30,7 @@ class IvyFileWriterTest extends Specification { testDirectory = new File(getClass().getClassLoader().getResource("deps").getFile()) } - def "test writing Ivy file for wheels"() { + def "test writing Ivy file for wheel which has runtime dependencies"() { given: VersionEntry testVersionEntry = new VersionEntry("testURI", "wheel", "Django-2.0.6-py3-none-any.whl") IvyFileWriter testIvyFileWriter = new IvyFileWriter("Django", "2.0.6", "bdist_wheel", [testVersionEntry]) diff --git a/pivy-importer/src/test/resources/deps/pywin32-223-cp27-cp27m-win_amd64.whl b/pivy-importer/src/test/resources/deps/pywin32-223-cp27-cp27m-win_amd64.whl new file mode 100644 index 0000000000000000000000000000000000000000..5c21355f40c05ac88966d462e20ace21e454d072 GIT binary patch literal 2342 zcmWIWW@Zs#0D%i?uhi! zY~9vf3sgH7h*fdwad8cH4)P2L@$~o8D=IEgJ!i;w$bhHyq3!Yt_7xHjSUNfvE|M;u zWz{9Pb?J@Vmv0qIYW(ki;NLASdf~WdPbg2Mc9mbK@8-uRjb5fDuGsa-rEP}L%!8tz zCvlk^<~A*}d~9`Rx0$od&$Ii?r)s&XyUg4m@$lP=g^#-@MPEN>Z?9zbuk^&J&{VaL z!5s0Z?mwyhNll%RfngUA%i(mtuWN{-i(`nRZ~sBR!v+E_@2CCYuVz{48Bl$?b5%o^ zLgo@C+x)q?$x^o`?#(=T|8YQ+MOB)O^?HS4Qj(MTKRH^@K5Vjg@*)>!%aX&Mw{M1Y z*%w<)PP!}ITz6uj)Q&>2vU7*sZr_^w;A8j6zKaS+FG+e?-8sIfZ6|l-w6~__f6YSA zr7Uwyp0jrI>xq@}w`=%Ve=+Nv*SjOYyluO1IUWS<&c^v%fBnvJs z+i~D`ze%v)wzjBAGcK(wQ}}i`r}qD*h`oB#QpJ=$*{!T8h*#K{b$I8yJ98IhyT~uE z+;=%*d-SVm|3lB!mR~3{dRFT%X1zgxWtYRIwU-1}JM&)H5IE7dYmJ1IdDJp%-gB$J zD*O8Enkb~PDxc%yoq{={(_hao&Jc-Cc6q_}w;=i3OQzcytM4?P{b%2}VtUZ(bA$opPMmp10%GslE*zF9U8=@E=od6h7ztiOuc$?UGj3 zA3qoWXmvDEQrpUTMB#i%Oi$EZw#A$l!43Ns9b2<{dy?VtEDpTVlD()s3_a;AO%!E>Yb*7}JHR871}oE9#u zY3~(Zyi7$v+Kcz@6cpV#$dW$aD!u#te_n^nob_T;V>T|?CI9ml zS91FT1{#3 z9mbwb506BuFVAADDhod!axlT~!OFW`(<^V6L^t|*8}3ff{xy5IXv^_k=d5STi6%65 zdHgPGzRCFcoz3C5!Q0QaW_~r=E#yDr#;%|GA)QsV2XgPe{=e>IZ|b_2_MoJ|1ekPX7pK#aW@5BG3&^$E{NP0i5_OD!tS%+Iq@Fw`^P<#JEWOD#$)$uF`} zNCK7m@#P>z3K|A_#s+!@n!H>=`S~Tfp2fNWrA4VZnMqa(X^A<-sk~eviRo4f$puE{ zx*#G~7g%}3C+4P@necM)as_xZGTAfWs%un$&IADg2!+GRTnq|ec}4~a2HrOpl2kRX zFv4j6t?}v#Kt94AZ1oe&9tH*>1{0uJ*nfEE6CP< z!D%h5lEG$QutXBrdoUW^KGZT6*}iZlT;4<}aY?llv&=!ZbPqEwOHoQ76iX{AFM>iA u=0g|_@hPsjV}&}f8N0;2=GS=m5Ij135v0Rt`z%mV;Ez*iLj literal 0 HcmV?d00001 diff --git a/version.properties b/version.properties index e7e2a475..8038e3d1 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=0.8.5 +version=0.8.6