tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

setup.py (1016B)


      1 import os
      2 import pathlib
      3 import re
      4 
      5 import setuptools
      6 
      7 
      8 root_dir = pathlib.Path(__file__).parent
      9 
     10 exec((root_dir / "src" / "websockets" / "version.py").read_text(encoding="utf-8"))
     11 
     12 # PyPI disables the "raw" directive. Remove this section of the README.
     13 long_description = re.sub(
     14    r"^\.\. raw:: html.*?^(?=\w)",
     15    "",
     16    (root_dir / "README.rst").read_text(encoding="utf-8"),
     17    flags=re.DOTALL | re.MULTILINE,
     18 )
     19 
     20 # Set BUILD_EXTENSION to yes or no to force building or not building the
     21 # speedups extension. If unset, the extension is built only if possible.
     22 if os.environ.get("BUILD_EXTENSION") == "no":
     23    ext_modules = []
     24 else:
     25    ext_modules = [
     26        setuptools.Extension(
     27            "websockets.speedups",
     28            sources=["src/websockets/speedups.c"],
     29            optional=os.environ.get("BUILD_EXTENSION") != "yes",
     30        )
     31    ]
     32 
     33 # Static values are declared in pyproject.toml.
     34 setuptools.setup(
     35    version=version,
     36    long_description=long_description,
     37    ext_modules=ext_modules,
     38 )