-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
58 lines (44 loc) · 1.95 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
# -*- coding: utf-8 -*-
# Copyright 2020 Arturo González, Diego Barrantes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from datetime import datetime
from pathlib import Path
from pybuilder.core import Author, before, init, use_plugin
use_plugin('python.core')
use_plugin('python.distutils')
use_plugin('pypi:pybuilder_pycharm_workspace')
name = 'pybuilder-archetype-base'
version = '0.1.1'
license = "Apache License, Version 2.0"
authors = [Author("Arturo GL", '[email protected]'), Author("Diego BM", '[email protected]')]
url = 'https://github.com/yeuk0/pybuilder-archetype-base'
summary = "External plugin for PyBuilder to generate a base project structure"
description = open('README.md', encoding='utf8').read()
default_task = ['clean', 'publish']
@init
def initialise(project):
project.set_property('distutils_readme_file_type', 'text/markdown')
@before('prepare')
def pack_files(project):
"""
Includes non-Python files in the build.
The plugin must contain every file present in ``resource`` package.
:param pybuilder.core.Project project: PyBuilder project instance
:return: None
"""
# https://github.com/pybuilder/pybuilder/issues/127#issuecomment-350513803
package_path = list(Path(__file__).parent.glob('src/main/python/*'))[0]
resources_paths = sorted(package_path.glob('resources/**'))
project.package_data.update(
{ package_path.name: [str((path.relative_to(package_path) / '*').as_posix()) for path in resources_paths] })