Skip to content

Commit

Permalink
Merge pull request #37 from visualDust/dev
Browse files Browse the repository at this point in the history
Fixed bugs caused by shit sucked win32
  • Loading branch information
visualDust authored Apr 15, 2023
2 parents 3d01663 + 0a30e17 commit 97a2b45
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion neetbox/daemon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def __attach_daemon(daemon_config):
)
if platform.system() == "Windows": # running on windows
try:
assert pkg.is_installed('win32api', try_install_if_not='pywin32'), "Please install 'pywin32' before using NEETBOX daemon"
assert pkg.is_installed('win32serviceutil', try_install_if_not='pypiwin32'), "Please install 'pywin32' before using NEETBOX daemon"
from neetbox.daemon._win_service import installService

installService(cfg=daemon_config)
except Exception as e:
logger.err(f"Could not install Windows service because {e}.")
Expand Down
4 changes: 2 additions & 2 deletions neetbox/daemon/_win_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from neetbox.daemon._daemon import daemon_process
from neetbox.logging import logger

from neetbox.utils import pkg
import win32api
import win32event
import win32service
Expand Down Expand Up @@ -71,8 +72,7 @@ def installService(
logger.log(f"Service {name} started successfully.")
return
except win32service.error as e:
logger.err(f"Service {name} start failed because {e}.")
raise
pass

# install and start the service
try:
Expand Down
2 changes: 1 addition & 1 deletion neetbox/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from neetbox.utils.utils import __PipPackageHealper as pkg
from neetbox.utils.utils import PipPackageHealper as pkg

__all__ = ["pkg"]
4 changes: 2 additions & 2 deletions neetbox/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def patch(func):
return func


class __PipPackageHealper(metaclass=Singleton):
class PipPackageHealper(metaclass=Singleton):
def __init__(self) -> None:
self.installed_packages = None

Expand Down Expand Up @@ -154,4 +154,4 @@ def is_installed(self, package: str, try_install_if_not: Union[str, bool] = True


# singleton
__PipPackageHealper = __PipPackageHealper()
PipPackageHealper = PipPackageHealper()

1 comment on commit 97a2b45

@vercel
Copy link

@vercel vercel bot commented on 97a2b45 Apr 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.