Skip to content

Commit 2325115

Browse files
ZhaoQi99zhaoqi219
authored andcommitted
fix: 🐛 generate loader.so
`from setuptools import setup` must be before Extension
1 parent 9c831e2 commit 2325115

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pyencrypt/loader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, path) -> None:
2626
self.__private_key = ''
2727
self.__cipher_key = ''
2828

29-
def get_filename(self, fullname: str) -> _Path:
29+
def get_filename(self, fullname: str) -> str:
3030
return self.path
3131

3232
def get_data(self, path: _Path) -> bytes:
@@ -51,7 +51,8 @@ def find_spec(self,
5151
else:
5252
file_path = Path(path[0]) / f'{fullname.rsplit(".",1)[-1]}.pye'
5353
else:
54-
file_path = f'{fullname}.pye'
54+
file_path = Path(f'{fullname}.pye')
55+
file_path = file_path.absolute().as_posix()
5556
if not os.path.exists(file_path):
5657
return None
5758
loader = EncryptFileLoader(file_path)

pyencrypt/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os
22
from pathlib import Path
33

4-
from Cython.Build import cythonize
54
from setuptools import setup
5+
from Cython.Build import cythonize
66

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

0 commit comments

Comments
 (0)