Fixed publisher publish relative path error

This commit is contained in:
Sven Heidemann 2020-11-22 00:10:52 +01:00
parent 96d3ccd8d2
commit b31c0dd23c
4 changed files with 43 additions and 10 deletions

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
sh_edraft common python library
sh_edraft
~~~~~~~~~~~~~~~~~~~
Library to share common classes and models used at sh-edraft.de
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.

View File

@ -153,10 +153,18 @@ class Publisher(PublisherBase):
dist_path = dist_path[:len(dist_path) - 1]
for file in self._included_files:
if file not in self._excluded_files:
is_file_excluded = False
if file in self._excluded_files:
is_file_excluded = True
else:
for excluded in self._excluded_files:
if file.__contains__(excluded):
is_file_excluded = True
if not is_file_excluded:
output_file = ''
if file.startswith('..'):
output_file = file.replace('..', '', 1)
output_file = file.replace('..', '')
elif file.startswith('.'):
output_file = file.replace('.', '', 1)

25
src/tests/__init__.py Normal file
View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
tests
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.0.1'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=0.1)

View File

@ -5,7 +5,7 @@ from sh_edraft.publish.model import Template
if __name__ == '__main__':
templates = [
Template(
'../publish_templates/*_template.txt',
'../../publish_templates/*_template.txt',
'*',
'',
'',
@ -18,7 +18,7 @@ if __name__ == '__main__':
Version(2020, 12, 0.1).to_dict()
),
Template(
'../publish_templates/*_template.txt',
'../../publish_templates/*_template.txt',
'sh_edraft',
'common python library',
'Library to share common classes and models used at sh-edraft.de',
@ -32,11 +32,11 @@ if __name__ == '__main__':
)
]
publisher = Publisher('./', '../dist', templates)
publisher = Publisher('../', '../../dist', templates)
publisher.exclude('./test.py')
publisher.include('../LICENSE')
publisher.include('../README.md')
publisher.exclude('../tests/')
publisher.include('../../LICENSE')
publisher.include('../../README.md')
publisher.create()
publisher.publish()