archlinuxcn / lilac

Lilac is the build bot for archlinuxcn
GNU General Public License v3.0
114 stars 40 forks source link

_add_into_array should not close array when origin line doesn't close #121

Closed farseerfc closed 4 years ago

farseerfc commented 5 years ago

This try to fix the problem. Can be tested with:

from lilac2.api import _add_into_array

def test_add_depends(line: str) -> str:
    print(_add_into_array(line, ['test']))

if __name__ == '__main__':
    test_add_depends('depends = (hello world)')
    test_add_depends('depends = (')

The last line should output

depends = ('test'

instead of

depends = ('test')
petronny commented 5 years ago

这样就支持换行了是吧

farseerfc commented 5 years ago

應該是的,只不過全都加到第一行上了,和原本的風格不太統一,不過應該能用。

renyuneyun commented 4 years ago

噫,這個好。 這樣也不用額外支持多行了,反正生成的PKGBUILD也不打算給人看。

因爲改了一點api.py的內容,現在有文件衝突。 我造了個類似的在: 88ff86f 5032276 (如果hash不管用的話,用這個鏈接