Skip to content

Commit

Permalink
fix: 🐛 generate loader.so
Browse files Browse the repository at this point in the history
`from setuptools import setup` must be before Extension
  • Loading branch information
ZhaoQi99 authored and zhaoqi219 committed Dec 3, 2021
1 parent 9c831e2 commit 2325115
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pyencrypt/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, path) -> None:
self.__private_key = ''
self.__cipher_key = ''

def get_filename(self, fullname: str) -> _Path:
def get_filename(self, fullname: str) -> str:
return self.path

def get_data(self, path: _Path) -> bytes:
Expand All @@ -51,7 +51,8 @@ def find_spec(self,
else:
file_path = Path(path[0]) / f'{fullname.rsplit(".",1)[-1]}.pye'
else:
file_path = f'{fullname}.pye'
file_path = Path(f'{fullname}.pye')
file_path = file_path.absolute().as_posix()
if not os.path.exists(file_path):
return None
loader = EncryptFileLoader(file_path)
Expand Down
2 changes: 1 addition & 1 deletion pyencrypt/setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
from pathlib import Path

from Cython.Build import cythonize
from setuptools import setup
from Cython.Build import cythonize

path = Path(os.getcwd()) / 'encrypted' / 'loader.py'
setup(ext_modules=cythonize(path.as_posix()), )

0 comments on commit 2325115

Please sign in to comment.