-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
76 lines (54 loc) · 2.13 KB
/
build.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from pathlib import Path
from pybuilder.core import use_plugin, init, Author, before
use_plugin('python.core')
use_plugin('python.distutils')
use_plugin('python.flake8')
use_plugin('python.unittest')
use_plugin('pypi:pybuilder_pycharm_workspace')
use_plugin('pypi:pybuilder_archetype_base')
path = Path(__file__).resolve().parent
name = path.name
authors = [Author('CEF Digital', '')]
license = 'European Union Public Licence V. 1.2'
version = '1.0.0'
description = 'FIWARE Context Broker Linked Data instance integration with the EDP',
url = 'https://github.com/ConnectingEurope/Context-Broker-EDP-LD'
entry_points = {
'console_scripts': 'cbld-edp=cbld_edp.commands:cli'
}
@init
def initialise(project):
project.depends_on_requirements('requirements.txt')
project.set_property('dir_source_main_python', 'src')
project.set_property('dir_source_unittest_python', 'tests')
project.set_property('unittest_module_glob', 'test_*')
project.set_property('project_base_path', path)
project.set_property('pycharm_workspace_project_path', path)
project.set_property('distutils_entry_points', entry_points)
@init(environments='develop')
def initialise_dev(project):
project.version = f'{project.version}.dev'
project.set_property('flake8_verbose_output', True)
@init(environments='production')
def initialise_pro(project):
project.set_property('flake8_break_build', True)
project.set_property('flake8_include_test_sources', True)
@before('prepare')
def pack_files(project):
"""
Includes non-Python files in the build.
:param pybuilder.core.Project project: PyBuilder project instance
:return: None
"""
package_path = list(Path(project.get_property('dir_source_main_python')).glob('*'))[0]
resources_paths = sorted(package_path.glob('**'))[1:]
project.package_data.update(
{ package_path.name: [str((path.relative_to(package_path) / '*').as_posix()) for path in resources_paths] })
if __name__ == '__main__':
import sys
if len(sys.argv) > 1 and sys.argv[1] == 'pycharm_builder':
from subprocess import run
pyb_command = ['pyb'] + sys.argv[2:]
run(pyb_command) # Add more complexity here as desired
else:
print("Nothing to do here")