Browse Source

PYADPT-86 - "Rename `native_pEp` into `_pEp`"

PYADPT-89 - "Make `native_pep` / `_pEp` a submodule of `pEp`"
More doc
PYADPT-100
heck 1 year ago
parent
commit
b5d3177292
17 changed files with 33 additions and 23 deletions
  1. +8
    -8
      setup.py
  2. +23
    -13
      src/pEp/__init__.py
  3. +0
    -0
      src/pEp/_pEp/basic_api.cc
  4. +0
    -0
      src/pEp/_pEp/basic_api.hh
  5. +0
    -0
      src/pEp/_pEp/identity.cc
  6. +0
    -0
      src/pEp/_pEp/identity.hh
  7. +0
    -0
      src/pEp/_pEp/message.cc
  8. +0
    -0
      src/pEp/_pEp/message.hh
  9. +0
    -0
      src/pEp/_pEp/message_api.cc
  10. +0
    -0
      src/pEp/_pEp/message_api.hh
  11. +1
    -1
      src/pEp/_pEp/pEpmodule.cc
  12. +0
    -0
      src/pEp/_pEp/pEpmodule.hh
  13. +0
    -0
      src/pEp/_pEp/str_attr.cc
  14. +0
    -0
      src/pEp/_pEp/str_attr.hh
  15. +0
    -0
      src/pEp/_pEp/user_interface.cc
  16. +0
    -0
      src/pEp/_pEp/user_interface.hh
  17. +1
    -1
      tests/test_message.py

+ 8
- 8
setup.py View File

@ -203,15 +203,15 @@ if sys.version_info[0] < 3:
FileNotFoundError = EnvironmentError
module_pEp = Extension(
'native_pEp',
'pEp._pEp',
sources=[
'src/pEp/native_pEp/pEpmodule.cc',
'src/pEp/native_pEp/basic_api.cc',
'src/pEp/native_pEp/identity.cc',
'src/pEp/native_pEp/message.cc',
'src/pEp/native_pEp/message_api.cc',
'src/pEp/native_pEp/str_attr.cc',
# 'src/pEp/native_pEp/user_interface.cc',
'src/pEp/_pEp/pEpmodule.cc',
'src/pEp/_pEp/basic_api.cc',
'src/pEp/_pEp/identity.cc',
'src/pEp/_pEp/message.cc',
'src/pEp/_pEp/message_api.cc',
'src/pEp/_pEp/str_attr.cc',
# 'src/pEp/_pEp/user_interface.cc',
],
)


+ 23
- 13
src/pEp/__init__.py View File

@ -1,25 +1,35 @@
# -*- coding: UTF-8 -*-
# pEp package
# This file is being exectued upon 'import pEp'
#
# The names that are in _pEp that do not begin with an underscore, will be be imported into, and "re-exported" from this module.
# They are defined in boost-python/C++, and are directly part of the pEpPythonAdapter API
# The names that are in _pEp that DO begin with an underscore, will not be imported into this module, but will be accessible like _pEp._underscore_function().
# They are not directly part of the pEpPythonAdapter API, and are meant to be wrapped in this module.
# Example:
# def underscore_function():
# _pEp._underscore_function()
#
# __all__ could be used to limit the symbols exported when using from <pkg> import *
from pkg_resources import DistributionNotFound, get_distribution
# TODO: Commented out until problems solved
# from pkg_resources import DistributionNotFound, get_distribution
# Imports all symbols EXCEPT the ones beginning with underscore
from ._pEp import *
# Import all symbols EXCEPT the ones beginning with underscore into the current namespace
from native_pEp import *
# TODO: inter-pkg ref to make sure which native_pEp in sys.path gets loaded
# like: pEp.native_pEp
# import the module
import native_pEp
# import the native module into the current namespace because we also need to access the names beginning
# with an underscore (of _pEp), but we dont want to import them into this module
import ._pEp
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
print("Package is not installed.")
# TODO: Commented out until problems solved
# try:
# __version__ = get_distribution(__name__).version
# except DistributionNotFound:
# print("Package is not installed.")
# Executed on module import
def init():
print(init, "called")
native_pEp._init_after_main_module()
_pEp._init_after_main_module()
def message_to_send(msg):


src/pEp/native_pEp/basic_api.cc → src/pEp/_pEp/basic_api.cc View File


src/pEp/native_pEp/basic_api.hh → src/pEp/_pEp/basic_api.hh View File


src/pEp/native_pEp/identity.cc → src/pEp/_pEp/identity.cc View File


src/pEp/native_pEp/identity.hh → src/pEp/_pEp/identity.hh View File


src/pEp/native_pEp/message.cc → src/pEp/_pEp/message.cc View File


src/pEp/native_pEp/message.hh → src/pEp/_pEp/message.hh View File


src/pEp/native_pEp/message_api.cc → src/pEp/_pEp/message_api.cc View File


src/pEp/native_pEp/message_api.hh → src/pEp/_pEp/message_api.hh View File


src/pEp/native_pEp/pEpmodule.cc → src/pEp/_pEp/pEpmodule.cc View File


src/pEp/native_pEp/pEpmodule.hh → src/pEp/_pEp/pEpmodule.hh View File


src/pEp/native_pEp/str_attr.cc → src/pEp/_pEp/str_attr.cc View File


src/pEp/native_pEp/str_attr.hh → src/pEp/_pEp/str_attr.hh View File


src/pEp/native_pEp/user_interface.cc → src/pEp/_pEp/user_interface.cc View File


src/pEp/native_pEp/user_interface.hh → src/pEp/_pEp/user_interface.hh View File


+ 1
- 1
tests/test_message.py View File

@ -40,7 +40,7 @@ def test_msg_enc_dec_roundtrip(create_alice_identity, create_bob_identity):
# AttributeError: module 'pEp' has no attribute 'PEP_rating'
# assert rating == pEp.PEP_rating.PEP_rating_reliable
# It seems to have changed to the following.
assert rating == pEp.native_pEp.rating.reliable
assert rating == pEp._pEp.rating.reliable
# The first 2 keys are Alice's ones, the last is Bob's one.
assert key_list[0] == key_list[1] == constants.ALICE_FP


Loading…
Cancel
Save