Bugfixes
This commit is contained in:
parent
0da83935fc
commit
b947789779
@ -1,6 +1,9 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
from importlib import util
|
||||||
from string import Template as stringTemplate
|
from string import Template as stringTemplate
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
@ -289,15 +292,30 @@ class PublisherService(PublisherABC):
|
|||||||
|
|
||||||
main = None
|
main = None
|
||||||
try:
|
try:
|
||||||
main = importlib.import_module(self._build_settings.main)
|
main_name = ''
|
||||||
|
|
||||||
|
if '.' in self._build_settings.main:
|
||||||
|
length = len(self._build_settings.main.split('.'))
|
||||||
|
main_name = self._build_settings.main.split('.')[length-1]
|
||||||
|
|
||||||
|
sys.path.insert(0, self._source_path)
|
||||||
|
main_mod = __import__(self._build_settings.main)
|
||||||
|
main = getattr(main_mod, main_name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Console.error('Could not find entry point', str(e))
|
Console.error('Could not find entry point', str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
if main is None or not hasattr(main, 'main'):
|
if main is None or not callable(main) and not hasattr(main, 'main'):
|
||||||
Console.error('Could not find entry point')
|
Console.error('Could not find entry point')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if callable(main):
|
||||||
|
mod_name = main.__module__
|
||||||
|
func_name = main.__name__
|
||||||
|
else:
|
||||||
|
mod_name = main.__name__
|
||||||
|
func_name = main.main.__name__
|
||||||
|
|
||||||
with open(setup_file, 'w+') as setup_py:
|
with open(setup_file, 'w+') as setup_py:
|
||||||
setup_string = stringTemplate(SetupTemplate.get_setup_py()).substitute(
|
setup_string = stringTemplate(SetupTemplate.get_setup_py()).substitute(
|
||||||
Name=self._project_settings.name,
|
Name=self._project_settings.name,
|
||||||
@ -313,7 +331,7 @@ class PublisherService(PublisherABC):
|
|||||||
Dependencies=self._project_settings.dependencies,
|
Dependencies=self._project_settings.dependencies,
|
||||||
EntryPoints={
|
EntryPoints={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
f'{self._build_settings.entry_point} = {main.__name__}:{main.main.__name__}'
|
f'{self._build_settings.entry_point} = {mod_name}:{func_name}'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
PackageData=self._build_settings.package_data
|
PackageData=self._build_settings.package_data
|
||||||
|
Loading…
Reference in New Issue
Block a user