summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-02-10 17:42:36 +0000
committerMark Haines <mark.haines@matrix.org>2015-02-10 17:42:36 +0000
commit7ed971d9b206a70f44c55588bdb1a4a33906fbe1 (patch)
treec56ff313ba1d9f39877bef6d77ceb68104c40591
parentLog all the exits from _attempt_new_transaction (diff)
downloadsynapse-7ed971d9b206a70f44c55588bdb1a4a33906fbe1.tar.xz
Single source version and python dependencies, prevent people accidentally installing with easy_install, use scripts rather than entry_points to install synctl
-rw-r--r--VERSION1
-rwxr-xr-xsetup.py80
-rw-r--r--synapse/python_dependencies.py6
3 files changed, 43 insertions, 44 deletions
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 1c29ff4d36..0000000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.6.1d
diff --git a/setup.py b/setup.py
index bd2766b24c..0215fba4c4 100755
--- a/setup.py
+++ b/setup.py
@@ -17,52 +17,52 @@
 import os
 from setuptools import setup, find_packages
 
+import setuptools.command.easy_install
 
-# Utility function to read the README file.
-# Used for the long_description.  It's nice, because now 1) we have a top level
-# README file and 2) it's easier to type in the README file than to put a raw
-# string in below ...
-def read(fname):
-    return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+def no_easy_install(self, spec, *args, **kargs):
+    raise RuntimeError(
+        "Missing requirement %r. Please use pip to install this dependency."
+        " See README.rst for instructions."
+        % (spec,)
+    )
+
+# Patch the easy_install command to prevent people accidentally installing
+# depedencies using it.
+setuptools.command.easy_install.easy_install.easy_install = no_easy_install
+
+
+here = os.path.abspath(os.path.dirname(__file__))
+
+
+def read_file(path):
+    """Read a file from the package. Takes a list of strings to join to
+    make the path"""
+    file_path = os.path.join(here, *path)
+    with open(file_path) as f:
+        return f.read()
+
+
+def exec_file(path):
+    """Execute a single python file to get the variables defined in it"""
+    result = {}
+    code = read_file(path)
+    exec(code, result)
+    return result
+
+version = exec_file(("synapse", "__init__.py"))["__version__"]
+dependencies = exec_file(("synapse", "python_dependencies.py"))
+long_description = read_file(("README.rst",))
 
 setup(
     name="matrix-synapse",
-    version=read("VERSION").strip(),
+    version=version,
     packages=find_packages(exclude=["tests", "tests.*"]),
     description="Reference Synapse Home Server",
-    install_requires=[
-        "syutil==0.0.2",
-        "matrix_angular_sdk>=0.6.1",
-        "Twisted==14.0.2",
-        "service_identity>=1.0.0",
-        "pyopenssl>=0.14",
-        "pyyaml",
-        "pyasn1",
-        "pynacl",
-        "daemonize",
-        "py-bcrypt",
-        "frozendict>=0.4",
-        "pillow",
-        "pydenticon",
-    ],
-    dependency_links=[
-        "https://github.com/matrix-org/syutil/tarball/v0.0.2#egg=syutil-0.0.2",
-        "https://github.com/pyca/pynacl/tarball/d4d3175589b892f6ea7c22f466e0e223853516fa#egg=pynacl-0.3.0",
-        "https://github.com/matrix-org/matrix-angular-sdk/tarball/v0.6.1/#egg=matrix_angular_sdk-0.6.1",
-    ],
-    setup_requires=[
-        "Twisted==14.0.2", # Here to override setuptools_trial's dependency on Twisted>=2.4.0
-        "setuptools_trial",
-        "setuptools>=1.0.0", # Needs setuptools that supports git+ssh.
-                             # TODO: Do we need this now? we don't use git+ssh.
-        "mock"
-    ],
+    install_requires=dependencies["REQUIREMENTS"].keys(),
+    dependency_links=dependencies["DEPENDENCY_LINKS"],
     include_package_data=True,
     zip_safe=False,
-    long_description=read("README.rst"),
-    entry_points="""
-    [console_scripts]
-    synctl=synapse.app.synctl:main
-    synapse-homeserver=synapse.app.homeserver:main
-    """
+    long_description=long_description,
+    scripts=["synctl"],
 )
diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index fd68da9dfb..e2a9d1f6a7 100644
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -5,7 +5,7 @@ logger = logging.getLogger(__name__)
 
 REQUIREMENTS = {
     "syutil==0.0.2": ["syutil"],
-    "matrix_angular_sdk==0.6.0": ["syweb>=0.6.0"],
+    "matrix_angular_sdk>=0.6.1": ["syweb>=0.6.1"],
     "Twisted==14.0.2": ["twisted==14.0.2"],
     "service_identity>=1.0.0": ["service_identity>=1.0.0"],
     "pyopenssl>=0.14": ["OpenSSL>=0.14"],
@@ -31,8 +31,8 @@ DEPENDENCY_LINKS = [
     ),
     github_link(
         project="matrix-org/matrix-angular-sdk",
-        version="v0.6.0",
-        egg="matrix_angular_sdk-0.6.0",
+        version="v0.6.1",
+        egg="matrix_angular_sdk-0.6.1",
     ),
     github_link(
         project="pyca/pynacl",