From 259d14893cbf6814366ac1827ca15369c041710e Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 22 Aug 2024 17:05:58 +0200 Subject: [PATCH] Implements extensions license updates #236 Supports only GNU/GPL 3.0 or later for add-ons. --- .../tests/files/addon-with-permissions.zip | Bin 765 -> 767 bytes .../addon-with-split-platforms-linux.zip | Bin 791 -> 793 bytes .../addon-with-split-platforms-windows.zip | Bin 791 -> 794 bytes extensions/tests/files/addon-without-dir.zip | Bin 708 -> 707 bytes ...addon-without-platforms-for-split-test.zip | Bin 748 -> 749 bytes extensions/tests/files/amaranth-1.0.8.zip | Bin 72865 -> 72868 bytes extensions/tests/files/blender_gis-2.2.8.zip | Bin 434471 -> 434477 bytes .../tests/files/edit_breakdown-0.1.0.zip | Bin 53969 -> 53969 bytes .../tests/files/invalid-addon-dir-no-init.zip | Bin 752 -> 751 bytes .../tests/files/invalid-addon-no-init.zip | Bin 558 -> 557 bytes .../tests/files/invalid-manifest-path.zip | Bin 679 -> 678 bytes .../tests/files/invalid-manifest-toml.zip | Bin 934 -> 936 bytes .../tests/files/invalid-missing-wheels.zip | Bin 723 -> 724 bytes extensions/tests/test_manifest.py | 27 ++++++++++++++++-- extensions/tests/test_submit.py | 20 ++++++------- extensions/tests/test_utils.py | 4 +-- files/validators.py | 17 ++++++++++- 17 files changed, 53 insertions(+), 15 deletions(-) diff --git a/extensions/tests/files/addon-with-permissions.zip b/extensions/tests/files/addon-with-permissions.zip index 53fc089a13c9422a94cf9e9d2094a09602ca6587..b693749a9fba2c25be7f2d2c1e474db34fa0fb69 100644 GIT binary patch delta 429 zcmey%`k!@z4evKb1_l-p1_p)zZ)TRs_Dm8J6D0*gkEfMZa5FHnKxHR(DROS@6pP%w zE>`T<#4W1z%YZ6YpsQkF@a;GBKWre-TK=Ew^zOwbE<7GQ3M|~tOLaU#MQ8q)6}9z! z(_4q%?=98WChT}x`~BVC-(MQUlK%4=S{|~qn9?7#H8l9DSBh~}d%%=FCXeK`YEyJh zFVcRPlh_$~z9)e5J==j09qX&P@%46c_qM(NwQiNE>s#Np72lL3+GnyS722;CO_`ql z+Jn>Nq5j8A&k!YEcaCRan;-aw#%nJ#<=K~ZAd&OL^i0ddb?@r8?Ybp$+u^e6u8%Xs z^MlRT?)h4=RC4XfJ?E#Zy{lOuagC?0%I@{&+S4v?)H)6>EwXrf^kAiiw^q|eKKGp* z!hd+5$agJw+VpX`lhH|*iPoAQxhKD1^k9dE*JN`hA33CuWn_|L28A&P13VNbFJv;- c1O+2XK!c)zl?|wpff)$@1L;@5_+elG0CJC`7XSbN delta 427 zcmey*`j>Tr4ev{41_qW_KqA1KnPsvglf=YCNr7)7X{8n142&#L*@<0>oDZg*jaWEo zHp`ERTU6_lRkG7S7^3P0$P5tS+i#nF*g&AI{4dwSyT=TdIWKhf_MFbgsNX8klNCEh z`O?X$Pt1OPw>`=EcEQuyFLig8vlxvF6jlO;(Np><>+X9px!* zk~d7umO$eYkjf=`NcRpCff`4-B3?s1R`9GQoZ&!z~5h zO&m46f=lG(&&^cHJwH=LUzz3Jk|X+)Uom>HLqlt_C6kXFQn)fQ$uWyCFfed1z{7Cz bVkTovECCqc&B_K;$-oSR|AF)iMi37G+p?#3 diff --git a/extensions/tests/files/addon-with-split-platforms-linux.zip b/extensions/tests/files/addon-with-split-platforms-linux.zip index 35a091914115b712a079c7637ac7442f329aa807..177ad6bdd4f71d16bf71a9d39bdfd85862855431 100644 GIT binary patch delta 401 zcmbQvHj{0_YEITJvB=v2Yd(ui+@e}<6?QyL5{OGHxEUB(zA-W|u!t})FqBR(^gnDM z&|3bV>$Gv_B>_VP!v+Bzo~fG@LIa;3yZ$BQw@gm^mjCmLZ*hsS@zsV&Jas9UKO=ZxbBz_U&O@Z}q ze|`P@vG#A^o#~+uofAu&7Fazr33|k=cv*is*CyY|j_X-6zt8@$M@38UH?u|U>X~mt zBV)CXc}vvzI{X!yaPF~@Q~XQ&h|qOL*M5JLDX>`5x_0%hiQDD!>y#D??|<&8Tz>EO z13k$-UrMz6_pQ(wILX+lK%&_1jqVXS-4r+03v8Jax(}RooKn zmMTAWLSxsR_Uc^1-pwMJxrcdWucnP>Tk5f?4wHADh&et-T~+6sgQ0iXs+;wBcJuFT zmuHPRL`>fy{YkDt<}*-D|nmN zbFPSIx|ABD^TqeCd)U;~IiSM^7fmvEDv&7l%Q?!Zt((%zwSf1Mf_TI9W|Q9qr+hAbn=;i3!950P}jE!TL)oG#=x2V?VhaFE#0pijMZU#n{Z;T8KEFugH46zgJ^A9Ts z94)tFOiy@malc5O~_h+6u@14r` z&ASaMUVaRjBPUg=ezhg#kI3`aZXI744kn(NvqMj?ddmc3tp+oXy>nRO_%1y;Y-sIy zJGpGqbU~)@5StY9MW(6zf6V_xKC5rse!22#Wfg#UpwD-(zZ0C_2*@&Et; delta 405 zcmbQmHl1z4YR;vVPa-yaiZc|NxJ9-8>HM}d5H79YW?*D_!OXw_CSn6@vkw~x-2JNE z^6Zv{T8TzUhUVK#iW8O!GzG5dE_SinIq8nd|9$F~3+0>H_LjeYoR{9n)AEkn$;E%J z^Q8VD-Phalrg&6s@R%@hYq`Q!!>Q^gH=Nlalwl-3^Yx6+OInV~X{4QWTN_@lFVCO9 z`g_+|EqSfg!Yo@w{ghSf1UCJuT&Hk7)9A%ig|~G=^Su@cZM1K=ynWWpxGQJ3Ce1ng zpqS~Ex5KWUqfYTx_ow*oJ+bLt|MZ5#ilVua>Gckd90Cr!hOaK4? diff --git a/extensions/tests/files/addon-without-dir.zip b/extensions/tests/files/addon-without-dir.zip index 0c488cefe2827d3e4ffbade2b6b1c2f8dd01f125..4656113bc95f21a9e27da88104b6241eab5c2d44 100644 GIT binary patch delta 328 zcmX@YdYE;>YGIu&vB(2k1?BcJFfb@EGBAiT$V_fvlBnloU~UOJo>m6Lr4`%^j4a=P zk}M)XRla?W+)RohE${zveO!0rn&yiDmsl&EH>w>GIki(3ocF!EpniT-V0-z@%KK+x zbQZK-uvc(-ys@0^W!I+GjFuFYm8(rTTwm^CUbW?!T;{aQi;{-BDh#V@zu6cion?^V zE=r2sZL1gg{cYp<)+cratA$v~)choUekzDmeV*sA+a&X`q~p`N-q*KIc*x{ExKf_B zG2N+7?O3_w9rXhX#g;seP`=Xs@9>ftqB$QP8_#&H8@g@c*`~VkH-B29mj0PPId1ZL s#tpKVzLo&`jDZ2@M}~&UHB9oFAkU+DJiwck4Wx(}2>%1=bs*IY0ImFcSO5S3 delta 315 zcmX@idW3btYGK8|&IrZFulMX{U|>*SWMB|wkeOW1BvH@Fz&!7}NE!&2R&X;gvbuxF+s$IP z&t$x>*ymT`ExAYifSKrzN*}?brT;g~d9QSBR^hf)uWOUK_h`J__Bcsx%AxlE6TYxc vUdOmW7Sr1jzyM%i0EPg=mdVvj@=Wu-Pj+My7GY%r2{QxXe;~acB+mcclA@EErS6zGdC8-G9G+ z|GRs;taEqGu*&CFDHS-VH1(Il#=j*q71}ph^>|I-t?%t$8`xklK-{r~^~ delta 347 zcmaFM`i6DFYR;*JFCx6GuiSY)af@pGuIt@tAY59(&A`a=f|-E1d-a>UuOjI0FAhsng9R* diff --git a/extensions/tests/files/amaranth-1.0.8.zip b/extensions/tests/files/amaranth-1.0.8.zip index 4765661d3fb1ef4bb95de6887bc082b43d08e8e8..c605e63da08c0bc77dd09a6722f1a1205275107c 100644 GIT binary patch delta 1172 zcmY*YYfMx}6uxKn?#e!ZMOf}WfF;0fyzJaDqYS+|0+)|s?QY|&wn$)CCYHdZM1(#JLJ`%*acc_ma_h!EDob$~& z-^?63A$Fe-1B>;qwI{n%wk>Epv$G<1Q*Y_%cY^F&wZn`o}+*(rVzvKUYUfPEhKODYh zZe1V#AX*iyy>)v-uQBHJy+{AK8b9;i6nEdfkN(Pc_e7evv~>&)OKTVXvEMg-DXaaW zkgac>k=$B6@UH6H9in%i`Ih2MJR%P92a4&rber9^HA1- z8Gq4&UGtO5Sa3`W9tZ1e+BtdBm92J6AGpj$)m--LZiy(-^~C1JXe>DB0=LYw!sTYu)2z?R)i937 zF+-MD^W0$dD-#CBvwp7Qxp=72bTtSx)G(XxzugRRnqif(QKv5((~V%JWj=H4Q|V%# zQeeZ(1X!v`Z4zi+(@bvd`2;4r5dTYnD(J)F$xuZ;^;N2lt90ZS~9 z4#QY)fd*0>R28};Fw#J9D(|x}nQat4s77e?;Hwih_dIK0r04&_W$-mtNYF&OL%ib8 z(8OWqTA9v`FBR5_E3E83Kp1!0LBc^RyLzq(P+()DEc%W|!ZxUZHVoL=1)XJwx8R1d ut|u`AJZ^WuLSh?L0WBQOF^M|V`Cyt~KhEqr_c delta 1227 zcmZ8ge@t6d6u#&7$KcVmuN2zyS_)HE2rI0*Uv9~4$kY+iMK&S80udBq*7;*>!EOD+ zt!Qy-=IGwok&QUI;51^)vf&6_l*we`ASmb(r*Y_%I)XSE>eOWDeeYJc*re_IzVn@P z?)lDrU47bUpSHCkx&1_0<)O^cKL#VU%lDWyml~9B)2%y}R9(-BUsffa~%MPYwDTzbx?tj5UozZ+6yu6(oaucn^^PUSfDniZqL5K zXuokwS^f^g)s)q`jc2!BZ~D9iO0AO*6khpzxb5ue0dX$!E0rN8J-;7%_XE647yUOk zAtW6L$su<3LkrDnS9? zwL>a)F90J=cVQ$6?6Ti=7oO9BQ4YF9!@pr*r+|yz z;4BIPJM6b9@CbGLd4&xIsG!zT4n8ozX7J+Ph2WF}W$FL|?iE2a<=o+DSLj7W(g@S4 z5{*WvrPeA8Ed+;LTIJ=A4jY-H?^JU(UagLsPa7IIajao!!d4TTY7)mx@C22&quC6S zJhJ_EYZsm3EXG7A2S18tcvd3?iM%Gbns*v!Iq)#fn4w##8>F?m|zK&JAp5MyY-cFUpuoWJq({FG|?uiv# zQfy8aD2b9rs^9r!b RH|GoRRVRr0ZjJJ`{sS{Id#L~b diff --git a/extensions/tests/files/blender_gis-2.2.8.zip b/extensions/tests/files/blender_gis-2.2.8.zip index 1de5c046e1ac61cc4bf8bbe33f52ab8a2948debd..854c086245b2f9b4d4e106657365258f52ab4278 100644 GIT binary patch delta 359 zcmZ2}NNVjNsfHHD7N!>F7M2#)Eo`}=!r@(Fk?+4OiaW)?z#z%Uz@W|`GyUQMHm!P2 z2IgyF$J6!$acKoN10%~fpe&0BP?>N4!K}juJZ>2_t9@`FE5*)i@I@8-1GkT|8}fG?k|6MYi>SexameZ_v&r=)&{J#2@9=$9y#)B za&92+&ARMO%3a(kwkr=eCEU2W`?BwgRLf>gn+Z=&)gR3Jy{rCK&i&cPw`H4{GIFb0 z%;?Zbt(&6t&ZJE<{s6}@)$dQwZ?C-Fc=E7^;QQFu-xj{jv;8deX<^^9V|CxAz1+ib zVW%7G8T(c9>$kHRzo_(jb9~c++Ux7z*#1jcx4k2bO~XqTGY}+z{$yYP`k0|%`q>3+ chMJ(TKnsTeZ&o&ts<}Ye>BYd%7Y5=20PU@l9RL6T delta 365 zcmZ2`NNV{ZsfHHD7N!>F7M2#)Eo`}=!rPaHM0iYc7CFMez#zcLz@W|`GkKx7@bp&; z*u?8O8JNA8ucm@6U~lJtL-vytP?t$Q!EzQoTFWa?Mh`EmY^`?mEqIpynDmzv5eL`@6o z4q80tn89;-mW_p$-@h!sx$lkOCyT%>+dFcru7AB=QCYZuXyLs#Yy&4S!I7ECg(lp|G>SyFN{sYO93+oB!GdzzyJ&lhAoZBq0>LkVG{ub ah?FLlkO=T*Wdo_63xu6s3=AD%AT9vXsEZK* diff --git a/extensions/tests/files/edit_breakdown-0.1.0.zip b/extensions/tests/files/edit_breakdown-0.1.0.zip index 71850b3b2cfccbb53c1fc6e73c628c64dbc6a6fe..dcd55846454745b4ed37ceb6f925b2a591b4c506 100644 GIT binary patch delta 224 zcmcb(l=uj!@aK^8MuJC#^+IADEf-0rS1z z?onVzyCh$JyUD)p;PMmWjU*UE&sdY-Qm+M zIn!i~__9cp;Jhb*y@r)Z;p8qyWoVI6IfVtrj0|P@O zBLjmLg9MPpzyM@2Y-zlDa`M89;*NoiuZje#M+o0ScuRtN|eurn}7p9b*&mZMmm diff --git a/extensions/tests/files/invalid-addon-dir-no-init.zip b/extensions/tests/files/invalid-addon-dir-no-init.zip index a4424c78e5eb8cafca2970f90b42f27a310fd9bb..87c32ba468585d3a17e9409a0b6bbfaacee466ec 100644 GIT binary patch delta 314 zcmeys`kr;dHqM4FvB(2k1?Bcl+;31XAAUTI0fN*eYnm?tTw<+s-l%p&2ENyy| delta 278 zcmaFQ`hj)AHcrLB&IrZFulMYqxZhx+o_M`)pCR`l1Cf^Rf4U~@T{z9Jsaa{4g~%=r zB~`P2vkQB!sEGc0?|Vs1_FmEVeY>l98-#K`Grpd3&`o;@`zf!u4|4?dcR4D$EH#r_ zF~P{#quFQixsFK}iw|ZurB9gXxV1q~i9am-`R{*GcQ*-4lbp?as5#YtQLB?YU(OQ$ z(=1WH9Xz!Tb8!95wpr%p7IV8m)jmEsZBZ5{(r(3*2za0cgw;(#lXOzzzD<)5w>GIki(3ocF!EpniT-V0-z@%KK+xbQZK-uvc(-ys@0^ zW!I+GjFuFYm8(rTTwm^CUbW?!T;{aQi;{-BDh#V@zu6cion?^VE=r2sZL9bFZDZK^ z)+cratA$v~)choUekzDmeV*sA+a&X`q~p`N-q*KIc*x{ExKf_BG2N+7?O3_w9rXhX z#g;seP`=Xs@9>ftqB$QP8_#&H8@g@c*`~VkH-B29mj0PPIc{o=kLK|JZ&o&tA|@bQ2c$DWsu=+PO?jFC delta 301 zcmZ3>vW{g!8mD4lXN2P8*L(I)%vY_S_gy578;DCQxEUB(UNSQ%H$KG1+@X-}mjV=4}wl`ONrw%0V~n zCG4lX;y%m~)ZgW(=(5yIYQ+R2V~=K^#pgOET`WGB-IP9IqT|*EJth9I@aMn(MTOtp zBrr{KHt(V4RR2Y-PV#&?OZ-o>ME&;EI?TcKH``{Jn_JB7X0h96GTvA0^DFU|+@pTL zO!P;kk6_Z${~PAKSGqQ^0RRGRd?x?^ diff --git a/extensions/tests/files/invalid-manifest-path.zip b/extensions/tests/files/invalid-manifest-path.zip index afc4e4981b94f77211befb6fb91044c1b78cd1ed..449050784a80f67a4dcb782a86301650c87ed375 100644 GIT binary patch delta 320 zcmZ3^x{P%~7w4=lvB(2k1?BcloUB_P9DY2_6NpPIxEUB(zA-W|u!t})F!=U4ax*E4 zw7mbv^>N*eYnm?tTw<+s-l%p&9?d?B&vi_?SbQ+MDSg63$E^)|O8jBr&wu}m3ctHa zV4CD?-b2l){)<|j;cp;44Wx$w014!Mq5uE@ diff --git a/extensions/tests/files/invalid-manifest-toml.zip b/extensions/tests/files/invalid-manifest-toml.zip index 942089d40e54a3660db0f9634251a7cdc800fd3d..84805cfc1d185e67422e9b0ce0eaf42f2278bf73 100644 GIT binary patch delta 327 zcmZ3+zJh&%Kj)GzvB<;+jr&edj4-HA4nLk24aB7t+zgB?-xwJfSVR~Y7<~ISu3|D2 zaQ$6#bV8kT%vu(1`Tq1|#T?}hokHUs4|CH@PICR*dvaCA#Ao-;?0jyb5XtkF*SW-J zZ8?kf1ny96U00*$2L-1sN$gKpvv!8U@qi-DIl8fDVrN^cX|i2cJX%yV;q1He{dbbz zY`Yrsvdh_YMvJ3dt9f5goy4iH=Ytt%nM55An(%S{(XU%HT;EiEdA2t4)yzx!M}Np1 ze%*0pDx(GKKlfQO3y(J_-PISqyr&>uW^G#Q<&RJ0?(FmzUUTg$)4im6n@Ogc|IfeU z-<-iH!YB*(HPCm4KyNBANB~(33_vDB!{nJvT7saUKnaG)SD17dvnDe#M>Fo49Lwy? JrpN@+0RUh^grWcd delta 311 zcmZ3%zKnf>Kd14G&WKAw+OJPej4-G#ED=qc_gy5dw1S&~k>w>b0|Uz|AmQ6*$bHB_ zp!NHoF6C-(UB9MgrCk;ru`CmXW*=soy?fRYr~i9BSHGC>bnl(-`=Z;IT)e7Za?jxE zHGwsbdY_H-mvFqgCwXW}NRHr?Ym&l8B!cu>FRuK&adq->71wkrmHB>po2=fRTYdOt z;tbb_V|uSc9Msnz(sEX`D|uOEt?eMnmK(tp^lkf&nPN*n_;!cYng;JZ(cQmj{_zi% z3Z|J1d42L8la;r;2x!?jf5xlk-;YIpDiun-b5DPlJ0l@AQ17Akw&#soxIWgG)H83+ zViaMNh5MO-fx(cGfkA;m0?1-u05Tc2OrFi8H94M1a`HVU6~>Io%*@e@J0{07JG03% Hfz$v1XA6Fk diff --git a/extensions/tests/files/invalid-missing-wheels.zip b/extensions/tests/files/invalid-missing-wheels.zip index 93aae3b3e35d71e333882e83c540e9f87a2633bf..ecf0080f93374aa062d14e8ec5504e9a30300b97 100644 GIT binary patch delta 348 zcmcc2dWCg@7w4KTvB(Mh5?gOg4A!nM2|u2e1;nKl+zgB?-xwJfSVR~Y7<~I3{f{UJ zw7&n-)n@H{`|4@6dp>(AZXD_EG~|s|ixyhY;`sVsb^0qQTZfAGhWD9giTmXJI^vah z_OA1C_7@AUYwd1Pk`8)3=etbWon3*e9~||+?zt$le@oW&P4VfOF8`Uo864Of_PnG1 zX7b;)vx071ww73`w{wED{+gt`ie)!lubfgoYdWPY*;94;PVXnH>)m*a(}W)T?w=zU z-|xRXy}04tnyW6?H@qr$m0!AM>&Xk3q82XR`r~Rv&qbE)*AGVNmr3wP<#H!2nalCb zJwns?_ssHRpTZNOl@9M`4De=V;R1S*fx$0%+2m@*X|nJD0gAZ;LqM8A0xSC$rgm1s2{}Ba&*7tw9 z+N>{x?ag^~Hbq~~>|;`r&*5n&r?F@xy1o8ao&HM7)}i9P;eF;g;wS2UwX_xL-c4T4 ze*1RZ>PN;MDh{t|IAp|b>l^HA&vDj!HGGRU zeY#`$_p&Lw-Xtr=T{v>*LCHTPRy<3;Dh{$8#{d4BU@gKju zIdNU&Y|nWMUY57YZ(Y}$lA*Y&qJVE-$8m|?Z{MtTZ|jymX1#VBtHMLSE$`edG>w1H zEI;-s{LMC%wtD6OZ)O%Q1`zN|UKTOAmT{^qJV1bg?u-l!(hL${1wbalmdW}|s?5L; Yn!JipW^yr;9An<(NlZ3uJ3*2R07tWt_W%F@ diff --git a/extensions/tests/test_manifest.py b/extensions/tests/test_manifest.py index 33715835..4e38ce21 100644 --- a/extensions/tests/test_manifest.py +++ b/extensions/tests/test_manifest.py @@ -482,11 +482,34 @@ class ValidateManifestFields(TestCase): self.assertEqual(1, len(e.exception.messages)) self.assertIn('version', e.exception.messages[0]) - def test_licenses(self): + def test_licenses_addons(self): data = { **self.mandatory_fields, **self.optional_fields, } + data['license'] = ['SPDX:GPL-3.0-or-later'] + ManifestValidator(data) + + data['license'] = ['SPDX:GPL-3.0-or-later', 'SPDX:CC0-1.0'] + ManifestValidator(data) + + message_begin = "Manifest value error: license expects a list of" + for license in ['SPDX:GPL-2.0-or-later', 'SPDX:MIT', 'SPDX:ZLIB']: + data['license'] = [license] + with self.assertRaises(ValidationError) as e: + ManifestValidator(data) + self.assertNotIn(message_begin, e.exception.messages[0]) + self.assertIn('SPDX:GPL-3.0-or-later', e.exception.messages[0]) + self.assertIn('for add-ons must be', e.exception.messages[0]) + + def test_licenses_themes(self): + data = { + **self.mandatory_fields, + **self.optional_fields, + } + data['type'] = 'theme' + data['tags'] = ['Dark'] + del data['permissions'] data['license'] = ['SPDX:GPL-2.0-or-later'] ManifestValidator(data) @@ -497,7 +520,7 @@ class ValidateManifestFields(TestCase): message_begin = "Manifest value error: license expects a list of" self.assertIn(message_begin, e.exception.messages[0]) - self.assertIn('[\'SPDX:GPL-2.0-or-later\']', e.exception.messages[0]) + self.assertIn('[\'SPDX:GPL-3.0-or-later\']', e.exception.messages[0]) data['license'] = ['SPDX:GPL-2.0-only'] with self.assertRaises(ValidationError) as e: diff --git a/extensions/tests/test_submit.py b/extensions/tests/test_submit.py index d3395fe1..f0e34b45 100644 --- a/extensions/tests/test_submit.py +++ b/extensions/tests/test_submit.py @@ -27,7 +27,7 @@ EXPECTED_EXTENSION_DATA = { 'type': 'add-on', 'schema_version': "1.0.0", }, - 'file_hash': 'sha256:28313858b9be34e6ecd15a63e28f626fb914dbdcc74c6d21c6536c9fad9de426', + 'file_hash': 'sha256:31c7489479d268af8622d3468dc40feee2287510dfa1f3adf6cbff37154d2e06', 'size_bytes': 53969, 'tags': ['Sequencer'], 'version_str': '0.1.0', @@ -42,8 +42,8 @@ EXPECTED_EXTENSION_DATA = { 'blender_version_min': '4.2.0', 'type': 'add-on', }, - 'file_hash': 'sha256:fb71280e43400b1fd343a6b5a1421dcb63c4fa69935963429bd6cae965dad2db', - 'size_bytes': 434471, + 'file_hash': 'sha256:67d6259eb99ae60d2abbcdfe312e7677621d8ac4f674158a91a5fde69e751548', + 'size_bytes': 434477, 'tags': ['3D View'], 'version_str': '2.2.8', 'slug': 'blender-gis', @@ -57,8 +57,8 @@ EXPECTED_EXTENSION_DATA = { 'blender_version_min': '4.2.0', 'type': 'add-on', }, - 'file_hash': 'sha256:09dcc1f0f9bc7103c48974da1d81f85b13326172fa008b2651cc4e77198654ed', - 'size_bytes': 72865, + 'file_hash': 'sha256:c218c1b7d13436be59706081adeb4125cb2e3118c5c2a45576ede1bbf61d3ec6', + 'size_bytes': 72868, 'tags': [], 'version_str': '1.0.8', 'slug': 'amaranth', @@ -74,8 +74,8 @@ EXPECTED_EXTENSION_DATA = { 'permissions': {'files': 'reading files', 'network': 'talking to server'}, 'platforms': ['linux-x64'], }, - 'file_hash': 'sha256:0431dac17d6e4d20c17a799dcc5ee915c12ea6d5b9a58a26b7850dea4aecc58c', - 'size_bytes': 765, + 'file_hash': 'sha256:7bcc6730049373856a8f1a801ddf4577e8e6948393b82db032514f0ec44945fc', + 'size_bytes': 767, 'tags': [], 'version_str': '0.1.0', 'slug': 'some-addon', @@ -92,8 +92,8 @@ EXPECTED_EXTENSION_DATA = { 'platforms': ['linux-x64', 'windows-x64'], 'build': {'generated': {'platforms': ['linux-x64']}}, }, - 'file_hash': 'sha256:b592384240eb04fb0f5e57741d93d8e15456d3fc27c837e2246422d6512ae002', - 'size_bytes': 791, + 'file_hash': 'sha256:719069cb27188e57600250fb3a8dcfb671b4c35a2996fb81b1f24943aa17f9ac', + 'size_bytes': 793, 'tags': [], 'version_str': '0.1.0', 'slug': 'some-addon', @@ -447,7 +447,7 @@ class SubmitFinaliseTest(CheckFilePropertiesMixin, TestCase): get_status_display='Awaiting Review', get_type_display='Add-on', hash=version.files.first().original_hash, - original_hash='sha256:2831385', + original_hash='sha256:31c7489', ) # We cannot check for the ManyToMany yet (tags, licences, permissions) diff --git a/extensions/tests/test_utils.py b/extensions/tests/test_utils.py index 98dd4417..6b5c60cf 100644 --- a/extensions/tests/test_utils.py +++ b/extensions/tests/test_utils.py @@ -10,7 +10,7 @@ class UtilsTest(TestCase): 'description': 'my description', 'permissions': [], 'tags': ['foo', 'bar'], - 'license': ['SPDX:GPL-2.0-or-later'], + 'license': ['SPDX:GPL-3.0-or-later'], 'blender_version_min': "2.9.3", 'blender_version_max': None, } @@ -18,7 +18,7 @@ class UtilsTest(TestCase): 'tagline': '', 'description': 'my description', 'tags': ['foo', 'bar'], - 'license': ['SPDX:GPL-2.0-or-later'], + 'license': ['SPDX:GPL-3.0-or-later'], 'blender_version_min': "2.9.3", } cleaned_dictionary = clean_json_dictionary_from_optional_fields(test_dictionary) diff --git a/files/validators.py b/files/validators.py index d1431aff..ac8591eb 100644 --- a/files/validators.py +++ b/files/validators.py @@ -248,13 +248,14 @@ class ListValidator(SimpleValidator): class LicenseValidator(ListValidator): - example = ['SPDX:GPL-2.0-or-later'] + example = ['SPDX:GPL-3.0-or-later'] @classmethod def validate(cls, *, name: str, value: list[str], manifest: dict) -> str: """Return error message if there is any license that is not accepted by the site""" is_error = False error_message = "" + gnu_gpl3_slug = "SPDX:GPL-3.0-or-later" if type(value) != list: is_error = True @@ -267,6 +268,20 @@ class LicenseValidator(ListValidator): unknown_value = license break + if ( + type(value) is list + and (manifest.get("type") == EXTENSION_TYPE_SLUGS_SINGULAR[EXTENSION_TYPE_CHOICES.BPY]) + and gnu_gpl3_slug not in value + ): + return mark_safe( + f'Manifest value error: license for add-ons must be ' + f'GPL v3.0 or later. ' + f'Additional license are possible, read the ' + f'' + f'documentation. e.g., {cls.example}.' + ) + if not is_error: return -- 2.30.2