Finally got the correct setup.py configuration for source of egg running

* py_modules parameter to setup() isn't documented in the setuptools
  docs, but is in a general 'python packaging' one.
* So now the main scripts are NOT within the `eddn` package..
* But all other code is...
* But the schema files don't need to be.

# Conflicts:
#	src/schemas/fssbodysignals-README.md
#	src/schemas/fssbodysignals-v1.0.json
#	src/schemas/fsssignaldiscovered-README.md
#	src/schemas/fsssignaldiscovered-v1.0.json
This commit is contained in:
Athanasius 2022-08-18 14:56:28 +01:00
parent 47ae96ddc1
commit c2dc30c8a2
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62
37 changed files with 15 additions and 13 deletions

View File

@ -80,11 +80,13 @@ setup(
author="EDCD (https://edcd.github.io/)", author="EDCD (https://edcd.github.io/)",
author_email="edcd@miggy.org", author_email="edcd@miggy.org",
url="https://github.com/EDCD/EDDN", url="https://github.com/EDCD/EDDN",
packages=find_packages("src", exclude=["*.tests"]), packages=find_packages("src"),
package_dir={"": "src"}, package_dir={"": "src"},
# <https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#py-modules>
py_modules=["Gateway", "Monitor", "Relay", "Bouncer"],
# This includes them for the running code, but that doesn't help # This includes them for the running code, but that doesn't help
# serve them up for reference. # serve them up for reference.
data_files=[("eddn/schemas", glob.glob("src/eddn/schemas/*.json"))], data_files=[("schemas", glob.glob("src/schemas/*.json"))],
# Yes, we pin versions. With python2.7 the latest pyzmq will NOT # Yes, we pin versions. With python2.7 the latest pyzmq will NOT
# work, for instance. # work, for instance.
install_requires=[ install_requires=[
@ -99,10 +101,10 @@ setup(
], ],
entry_points={ entry_points={
"console_scripts": [ "console_scripts": [
"eddn-gateway = eddn.Gateway:main", "eddn-gateway = Gateway:main",
"eddn-relay = eddn.Relay:main", "eddn-relay = Relay:main",
"eddn-monitor = eddn.Monitor:main", "eddn-monitor = Monitor:main",
"eddn-bouncer = eddn.Bouncer:main", "eddn-bouncer = Bouncer:main",
], ],
}, },
) )
@ -220,7 +222,7 @@ except OSError:
pass pass
shutil.copytree( shutil.copytree(
"src/eddn/schemas", "src/schemas",
SHARE_EDDN_FILES / "schemas", SHARE_EDDN_FILES / "schemas",
copy_function=shutil.copyfile, # type: ignore copy_function=shutil.copyfile, # type: ignore
) )

View File

@ -20,9 +20,9 @@ from gevent import monkey
from pkg_resources import resource_string from pkg_resources import resource_string
from zmq import PUB as ZMQ_PUB from zmq import PUB as ZMQ_PUB
from conf.Settings import Settings, load_config from eddn.conf.Settings import Settings, load_config
from core.Validator import ValidationSeverity, Validator from eddn.core.Validator import ValidationSeverity, Validator
from core.logger import logger from eddn.core.logger import logger
monkey.patch_all() monkey.patch_all()
import bottle # noqa: E402 import bottle # noqa: E402
@ -40,8 +40,8 @@ sender = zmq_context.socket(ZMQ_PUB)
validator = Validator() validator = Validator()
# This import must be done post-monkey-patching! # This import must be done post-monkey-patching!
from core.StatsCollector import StatsCollector # noqa: E402 from eddn.core.StatsCollector import StatsCollector # noqa: E402
from core.EDDNWSGIHandler import EDDNWSGIHandler from eddn.core.EDDNWSGIHandler import EDDNWSGIHandler
stats_collector = StatsCollector() stats_collector = StatsCollector()
stats_collector.start() stats_collector.start()

View File

@ -5,7 +5,7 @@ from typing import Dict
import simplejson import simplejson
from conf.Version import __version__ as version from eddn.conf.Version import __version__ as version
class _Settings(object): class _Settings(object):