diff --git a/Dockerfile b/Dockerfile index 76f967c..549f059 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,36 @@ RUN apt-get install -y npm RUN npm install -g http-server RUN pip install pydata-sphinx-theme RUN pip install git+https://gitea.parrrate.ru/PTV/rainbowadn.git@e9fba7b064902ceedee0dd5578cb47030665a6aa -COPY docs/Makefile Makefile + +RUN mkdir /app/docs/ +RUN mkdir /app/docs/build/ +RUN mkdir /app/docs/build/html/ +WORKDIR /app/legacy/ +RUN git clone --branch 1.0 https://gitea.parrrate.ru/PTV/ptvp35.git +WORKDIR /app/legacy/ptvp35/ +RUN python traced_example.py > traced_example.txt +RUN python traced_example.py all > traced_example_all.txt +RUN cp -r docs/source/ ./source/ +RUN cp docs/Makefile ./Makefile +RUN make html +RUN cp -r /app/legacy/ptvp35/build/html/ /app/docs/build/html/1.0/ +RUN git reset --hard + +RUN git fetch && git checkout 1.1rc0 +WORKDIR /app/legacy/ptvp35/docs/ +RUN make html +RUN cp -r /app/legacy/ptvp35/docs/build/html/ /app/docs/build/html/1.1rc0/ +RUN rm -r /app/legacy/ptvp35/docs/build/ +WORKDIR /app/legacy/ptvp35/ + +WORKDIR /app/ + +COPY docs/Makefile docs/Makefile COPY setup.py setup.py COPY traced_example.py traced_example.py COPY ptvp35 ptvp35 -RUN python traced_example.py > traced_example.txt -RUN python traced_example.py all > traced_example_all.txt -COPY docs/source source +COPY docs/source docs/source +WORKDIR /app/docs/ RUN make html -WORKDIR /app/build/html/ +WORKDIR /app/docs/build/html/ CMD [ "http-server", "-p", "80" ] diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf..9056a97 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -17,4 +17,6 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile + python ../traced_example.py > ../traced_example.txt + python ../traced_example.py all > ../traced_example_all.txt @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/source/conf.py b/docs/source/conf.py index 10a201f..ca81efa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -9,7 +9,7 @@ project = 'ptvp35' copyright = '2022, PARRRATE TNV' author = 'PARRRATE TNV' -with open('../setup.py') as f: +with open('../../setup.py') as f: _src = f.read() _src = _src[_src.index('version=\'') + 9:] _src = _src[:_src.index('\'')] @@ -37,4 +37,4 @@ html_static_path = ['_static'] import sys import os.path -sys.path.insert(0, os.path.abspath('..')) +sys.path.insert(0, os.path.abspath('../..')) diff --git a/docs/source/ordering.rst b/docs/source/ordering.rst index 775f703..03c12aa 100644 --- a/docs/source/ordering.rst +++ b/docs/source/ordering.rst @@ -4,17 +4,17 @@ Traced example of how ordering works in persistence5 Source ------ -.. literalinclude :: ../traced_example.py +.. literalinclude :: ../../traced_example.py :language: python3 Writes/reads log ---------------- -.. literalinclude :: ../traced_example.txt +.. literalinclude :: ../../traced_example.txt :language: plain Everything log -------------- -.. literalinclude :: ../traced_example_all.txt +.. literalinclude :: ../../traced_example_all.txt :language: plain diff --git a/ptvp35/__init__.py b/ptvp35/__init__.py index 0f87f27..9de0da0 100644 --- a/ptvp35/__init__.py +++ b/ptvp35/__init__.py @@ -763,7 +763,6 @@ class TransactionView(VirtualConnection): """do something (inside of async with), then wait for submitted changes to be committed.""" return FutureContext(self.__subfuture) - @nightly def rollback(self, /) -> None: """clear unsubmitted changes.""" self.__delta.clear() @@ -963,6 +962,8 @@ class Transaction: async def __aexit__(self, exc_type, exc_val, exc_tb): if exc_type is None: await self.__view.commit() + else: + self.__view.rollback() self._clean() def _clean(self, /) -> None: @@ -978,4 +979,6 @@ class Transaction: def __exit__(self, exc_type, exc_val, exc_tb): if exc_type is None: self.__view.submit() + else: + self.__view.rollback() self._clean() diff --git a/setup.py b/setup.py index 0cce3de..7408ba2 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='ptvp35', - version='1.0', + version='1.1rc0', packages=['ptvp35'], url='https://gitea.ongoteam.net/PTV/ptvp35', license='MIT',