Skip to content

Commit

Permalink
Allow import from windows environment (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Mar 28, 2022
1 parent 210bfb0 commit 3848def
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions changes/47.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow importing aiotools on Windows platforms, removing incompatible modules from the default `__all__` import list
39 changes: 27 additions & 12 deletions src/aiotools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,54 @@
import sys
import pkgutil

# Import submodules only when installed properly
from . import (
context,
defer as _defer,
fork as _fork,
func,
iter as _iter,
server,
taskgroup,
timer,
)

import pkgutil
_version_data = pkgutil.get_data("aiotools", "VERSION")
if _version_data is None:
__version__ = '0.0.dev'
else:
__version__ = _version_data.decode('utf8').strip()
_is_linux = sys.platform.startswith('linux')

if _is_linux:
from . import (
fork as _fork,
server,
)

__all__ = (
*context.__all__,
*_defer.__all__,
*_fork.__all__,
*func.__all__,
*_iter.__all__,
*server.__all__,
*taskgroup.__all__,
*timer.__all__,
'__version__',
)

from .context import * # noqa
from .defer import * # noqa
from .fork import * # noqa
from .func import * # noqa
from .iter import * # noqa
from .taskgroup import * # noqa
from .timer import * # noqa
from .server import * # noqa

if _is_linux:
__all__ = (
*__all__,
*_fork.__all__,
*server.__all__,
)

from .fork import * # noqa
from .server import * # noqa


_version_data = pkgutil.get_data("aiotools", "VERSION")
if _version_data is None:
__version__ = '0.0.dev'
else:
__version__ = _version_data.decode('utf8').strip()

0 comments on commit 3848def

Please sign in to comment.