-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow import from windows environment (#47)
- Loading branch information
1 parent
210bfb0
commit 3848def
Showing
2 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |