Correct requirements
authorymh <ymh.work@gmail.com>
Sat, 24 Nov 2018 09:31:16 +0100
changeset 175 6fcda59daff8
parent 174 ac1a026edd58
child 176 a24f6bf72f6a
Correct requirements
.hgignore
client/package.json
client/public/manifest.json
src/requirements/base.txt
src/requirements/base.txt.in
src/setup.py
--- a/.hgignore	Fri Nov 16 17:01:19 2018 +0100
+++ b/.hgignore	Sat Nov 24 09:31:16 2018 +0100
@@ -41,3 +41,9 @@
 .ruby-version$
 
 ^design/api/node_modules
+
+^deploy/.venv
+^deploy/.vagrant
+^deploy/group_vars/.*\.yml$
+^deploy/hosts/hosts\.prod$
+^deploy/hosts/hosts\.test$
--- a/client/package.json	Fri Nov 16 17:01:19 2018 +0100
+++ b/client/package.json	Sat Nov 24 09:31:16 2018 +0100
@@ -61,7 +61,8 @@
     "start": "npm-run-all -p watch-css start-js",
     "build": "npm run build-css && react-scripts build",
     "test": "react-scripts test --env=jsdom",
-    "eject": "react-scripts eject"
+    "eject": "react-scripts eject",
+    "set-version": "bash -c 'sed -i \"\" -e \"s/\\([:space:]*\\\"version\\\"[[:space:]]*\\:[[:space:]]*\\\"\\)[\\.0-9]*\\(\\\".*\\)/\\1${1}\\2/\" package.json' 0"
   },
   "browserslist": [
     ">0.2%",
--- a/client/public/manifest.json	Fri Nov 16 17:01:19 2018 +0100
+++ b/client/public/manifest.json	Sat Nov 24 09:31:16 2018 +0100
@@ -1,6 +1,6 @@
 {
-  "short_name": "React App",
-  "name": "Create React App Sample",
+  "short_name": "Irinotes",
+  "name": "Irinotes application",
   "icons": [
     {
       "src": "favicon.ico",
--- a/src/requirements/base.txt	Fri Nov 16 17:01:19 2018 +0100
+++ b/src/requirements/base.txt	Sat Nov 24 09:31:16 2018 +0100
@@ -1,31 +1,31 @@
-certifi==2018.4.16
+certifi==2018.10.15
 chardet==3.0.4
 defusedxml==0.5.0
 dj-database-url==0.5.0
-Django==2.0.7
-django-allauth==0.36.0
-git+https://github.com/IRI-Research/django-auditlog@master#egg=django-auditlog
-django-colorful==1.2
+Django==2.1.3
+django-allauth==0.38.0
+django-auditlog==0.4.5+iri
+django-colorful==1.3
 django-concurrency==1.4
-django-cors-headers==2.3.0
-django-extensions==2.0.7
-django-filter==1.1.0
+django-cors-headers==2.4.0
+django-extensions==2.1.4
+django-filter==2.0.0
 django-guardian==1.4.9
 django-jsonfield==1.0.1
 django-rest-auth==0.9.3
-djangorestframework==3.8.2
+djangorestframework==3.9.0
 djangorestframework-jwt==1.11.0
-drf-nested-routers==0.90.2
+drf-nested-routers==0.91
 idna==2.7
-Markdown==2.6.11
+Markdown==3.0.1
 oauthlib==2.1.0
 PyJWT==1.6.4
-python-dateutil==2.6.0
+python-dateutil==2.7.5
 python-decouple==3.1
 python3-openid==3.1.0
-pytz==2018.5
-requests==2.19.1
+pytz==2018.7
+requests==2.20.1
 requests-oauthlib==1.0.0
 six==1.11.0
 Unipath==1.1
-urllib3==1.23
+urllib3==1.24.1
--- a/src/requirements/base.txt.in	Fri Nov 16 17:01:19 2018 +0100
+++ b/src/requirements/base.txt.in	Sat Nov 24 09:31:16 2018 +0100
@@ -1,3 +1,3 @@
 # must run "pip install -r base.txt.in" in src/requirements
---process-dependency-links
+# --process-dependency-links
 -e ..
--- a/src/setup.py	Fri Nov 16 17:01:19 2018 +0100
+++ b/src/setup.py	Sat Nov 24 09:31:16 2018 +0100
@@ -1,11 +1,73 @@
 import os
+import re
+import sys
+from distutils.command.install import INSTALL_SCHEMES
+from distutils.command.install_data import install_data
+from shutil import move
+from tempfile import mkstemp
+
+from setuptools import Command
+
 try:
     from setuptools import setup
 except ImportError:
     from distutils.core import setup
-from distutils.command.install_data import install_data
-from distutils.command.install import INSTALL_SCHEMES
-import sys
+
+
+"""
+See: https://dankeder.com/posts/adding-custom-commands-to-setup-py/
+"""
+class SetVersion(Command):
+    """
+    Set the version for the project
+    """
+    description = "Set the version for the project"
+    # command_consumes_arguments = True
+    user_options = [
+        ('version=', 'v', 'version str')
+    ]
+
+    def initialize_options(self):
+        """Set default values for options."""
+        # Each user option must be listed here with their default value.
+        self.version = None
+
+    def finalize_options(self):
+        """Post-process options."""
+        if self.version is None:
+            raise Exception("Parameter --version is missing")
+        version_matches = re.match(r"(\d+).(\d+)(?:\.(\d+))?(?:(?:.(dev))|(?:(a|b|rc)(.*)))?", self.version)
+        if version_matches is None:
+            raise Exception("Parameter --version is not a version string (see )")
+        version_list = version_matches.groups()
+        version_tag = {'a': 'alpha', 'b': 'beta', 'rc': 'rc'}.get(version_list[4],'final')
+        version_ext = int(version_list[5] or 0)
+        if version_list[3] and version_list[3] == 'dev':
+            version_tag = 'alpha'
+            version_ext = 0
+
+        self.version_tuple = (
+            int(version_list[0]),
+            int(version_list[1]),
+            int(version_list[2] or 0),
+            version_tag,
+            version_ext,
+        )
+
+    def run(self):
+        filepath = os.path.join(os.path.dirname(os.path.realpath(__file__)),"irinotes","__init__.py")
+        print("Changing VERSION in %s to %r" % (filepath, self.version_tuple))
+        fh, abs_path = mkstemp()
+        with os.fdopen(fh,'w') as temp_file:
+            with open(filepath, 'r') as initfiles:
+                for l in initfiles:
+                    if re.match(r"\s*VERSION\s*=\s*\(\d+\s*,\s*\d+\s*,\s*\d+,\s*\".+\",\s*.+\s*\)", l):
+                        temp_file.write("VERSION = %r" % (self.version_tuple,))
+                    else:
+                        temp_file.write(l)
+        os.remove(filepath)
+        move(abs_path, filepath)
+
 
 
 class osx_install_data(install_data):
@@ -109,6 +171,8 @@
     with open('README', 'r') as f:
         long_description = f.read()
 
+    cmdclasses = {**cmdclasses, **{ 'set_version': SetVersion }}
+
     setup(
         script_name=setup_script_name,
         script_args=setup_script_args,
@@ -140,7 +204,7 @@
             "Unipath",
             "dj-database-url",
             "six",
-            "django-auditlog == 0.4.5dev",
+            "django-auditlog @ https://github.com/IRI-Research/django-auditlog/tarball/master#egg=django-auditlog-0.4.5+IRI",
             "django-extensions",
             "djangorestframework >= 3.6",
             "django-rest-auth[with_social]",
@@ -153,9 +217,9 @@
             "drf-nested-routers",
             "markdown"
         ],
-        dependency_links=[
-            "https://github.com/IRI-Research/django-auditlog/tarball/master#egg=django-auditlog-0.4.5dev"
-        ]
+        # dependency_links=[
+        #     "https://github.com/IRI-Research/django-auditlog/tarball/master#egg=django-auditlog-0.4.5dev"
+        # ]
     )