File size: 1,224 Bytes
5e56bcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import os

# Function to safely check if Cython is installed
def has_cython():
    try:
        from Cython.Build import cythonize
        return True
    except ImportError:
        return False

# Define extensions for "Pro" modules that need obfuscation
extensions = []

if has_cython():
    from Cython.Build import cythonize
    
    # List of modules to compile to binary
    # We will compile the core coordinator and licensing logic
    modules_to_compile = [
        "upif/core/coordinator.py",
        "upif/core/licensing.py",
        "upif/modules/neural_guard.py",
        "upif/integrations/openai.py",
        "upif/integrations/langchain.py"
    ]
    
    # Only try to compile if files exist
    existing_modules = [m for m in modules_to_compile if os.path.exists(m)]
    
    if existing_modules:
        extensions = cythonize(
            existing_modules,
            compiler_directives={'language_level': "3"}
        )

setup(
    ext_modules=extensions,
    entry_points={
        "console_scripts": [
            "upif=upif.cli:main",
        ],
    },
    include_package_data=True,
    zip_safe=False,
)