2021.4.1 #11
14
cpl.json
14
cpl.json
@ -32,13 +32,23 @@
|
|||||||
"EntryPoint": "cpl",
|
"EntryPoint": "cpl",
|
||||||
"IncludePackageData": "False",
|
"IncludePackageData": "False",
|
||||||
"Included": [
|
"Included": [
|
||||||
"src/cpl_cli/templates/new/console/src/tests"
|
"src/cpl_cli/templates/new/console/src/tests/"
|
||||||
],
|
],
|
||||||
"Excluded": [
|
"Excluded": [
|
||||||
"*/__pycache__",
|
"*/__pycache__",
|
||||||
"*/logs",
|
"*/logs",
|
||||||
"*/tests"
|
"*/tests"
|
||||||
],
|
],
|
||||||
"PackageData": {}
|
"PackageData": {
|
||||||
|
"cpl_cli": [
|
||||||
|
"templates/*",
|
||||||
|
"templates/build/*",
|
||||||
|
"templates/new/*",
|
||||||
|
"templates/new/console/*",
|
||||||
|
"templates/new/console/src/*",
|
||||||
|
"templates/new/console/src/tests/*",
|
||||||
|
"templates/publish/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ class Publisher(PublisherABC):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_module_name_from_dirs(file: str) -> str:
|
def _get_module_name_from_dirs(file: str) -> str:
|
||||||
if 'src/' in file:
|
if 'src/' in file:
|
||||||
file = file.replace('src/', '')
|
file = file.replace('src/', '', 1)
|
||||||
|
|
||||||
dirs = os.path.dirname(file).split('/')
|
dirs = os.path.dirname(file).split('/')
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
@ -89,8 +89,7 @@ class Publisher(PublisherABC):
|
|||||||
relative_path = os.path.relpath(r)
|
relative_path = os.path.relpath(r)
|
||||||
file_path = os.path.join(relative_path, os.path.relpath(sub_file))
|
file_path = os.path.join(relative_path, os.path.relpath(sub_file))
|
||||||
|
|
||||||
if not self._is_path_excluded(relative_path):
|
self._included_files.append(os.path.relpath(file_path))
|
||||||
self._included_files.append(os.path.relpath(file_path))
|
|
||||||
|
|
||||||
elif os.path.isfile(rel_path):
|
elif os.path.isfile(rel_path):
|
||||||
self._included_files.append(rel_path)
|
self._included_files.append(rel_path)
|
||||||
@ -114,7 +113,7 @@ class Publisher(PublisherABC):
|
|||||||
|
|
||||||
def _create_packages(self):
|
def _create_packages(self):
|
||||||
for file in self._included_files:
|
for file in self._included_files:
|
||||||
if file.endswith('__init__.py'):
|
if file.endswith('console_src_tests.__init__.py'):
|
||||||
template_content = ''
|
template_content = ''
|
||||||
module_file_lines: list[str] = []
|
module_file_lines: list[str] = []
|
||||||
|
|
||||||
@ -175,7 +174,7 @@ class Publisher(PublisherABC):
|
|||||||
for file in self._included_files:
|
for file in self._included_files:
|
||||||
dist_file = file
|
dist_file = file
|
||||||
if 'src/' in dist_file:
|
if 'src/' in dist_file:
|
||||||
dist_file = dist_file.replace('src/', '')
|
dist_file = dist_file.replace('src/', '', 1)
|
||||||
|
|
||||||
output_path = os.path.join(build_path, os.path.dirname(dist_file))
|
output_path = os.path.join(build_path, os.path.dirname(dist_file))
|
||||||
output_file = os.path.join(build_path, dist_file)
|
output_file = os.path.join(build_path, dist_file)
|
||||||
@ -215,6 +214,14 @@ class Publisher(PublisherABC):
|
|||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _package_files(directory):
|
||||||
|
paths = []
|
||||||
|
for (path, directories, filenames) in os.walk(directory):
|
||||||
|
for filename in filenames:
|
||||||
|
paths.append(os.path.join('..', path, filename))
|
||||||
|
return paths
|
||||||
|
|
||||||
def _create_setup(self):
|
def _create_setup(self):
|
||||||
setup_file = os.path.join(self._output_path, 'setup.py')
|
setup_file = os.path.join(self._output_path, 'setup.py')
|
||||||
if os.path.isfile(setup_file):
|
if os.path.isfile(setup_file):
|
||||||
|
Loading…
Reference in New Issue
Block a user