File: requirements-splitter.py

package info (click to toggle)
python-pycm 4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,952 kB
  • sloc: python: 5,029; sh: 8; makefile: 6
file content (23 lines) | stat: -rw-r--r-- 600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
"""Requirements splitter."""

PLOT_LIB_LIST = ["matplotlib", "seaborn"]
test_req = ""
plot_req = ""

with open('dev-requirements.txt', 'r') as f:
    for line in f:
        plot_lib_flag = False
        for lib in PLOT_LIB_LIST:
            if line.find(lib) != -1:
                plot_lib_flag = True
                plot_req += line
                break
        if '==' not in line and not plot_lib_flag:
            test_req += line

with open('test-requirements.txt', 'w') as f:
    f.write(test_req)

with open('plot-requirements.txt', 'w') as f:
    f.write(plot_req)