forked from shuup/shuup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsing.py
31 lines (27 loc) · 929 Bytes
/
parsing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This file is part of Shuup.
#
# Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import os
def get_test_requirements_from_tox_ini(path):
result = []
between_begin_and_end = False
with open(os.path.join(path, 'tox.ini'), 'rt') as fp:
for line in fp:
if line.strip() == '# BEGIN testing deps':
between_begin_and_end = True
elif line.strip() == '# END testing deps' or not line[0].isspace():
between_begin_and_end = False
elif between_begin_and_end:
result.append(line.strip())
return result
def get_long_description(path):
"""
Get long description from file.
"""
if path:
with open(path, 'rt') as fp:
return fp.read()
return None