Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisAlejandro committed Apr 24, 2022
2 parents 2807b1b + ba05024 commit 00597f9
Show file tree
Hide file tree
Showing 19 changed files with 201 additions and 215 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Expand Up @@ -33,6 +33,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: develop
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
Expand All @@ -54,6 +55,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-py${{ matrix.python-version }}-odoo${{ matrix.odoo-branch }}
path-to-lcov: ./.lcov
parallel: true

finish:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: develop
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -39,6 +39,7 @@ htmlcov/
.tox/
.coverage
.coverage.*
.lcov
.cache
nosetests.xml
coverage.xml
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.rst
Expand Up @@ -101,8 +101,7 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 3.5 - 3.8, and for PyPy3. Check
https://travis-ci.org/LuisAlejandro/candyshop/pull_requests
3. Check https://github.com/LuisAlejandro/candyshop/actions
and make sure that the tests pass for all supported Python versions.

Tips
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Expand Up @@ -2,17 +2,21 @@ FROM dockershelf/python:3.10
LABEL maintainer "Luis Alejandro Martínez Faneyth <luis@collagelabs.org>"

RUN apt-get update && \
apt-get install sudo python3.10-venv git
apt-get install sudo python3.10-venv git make libyaml-dev

RUN ln -s /usr/bin/python3.10 /usr/bin/python

ADD requirements.txt requirements-dev.txt /root/
RUN pip3 install -r /root/requirements.txt -r /root/requirements-dev.txt
RUN rm -rf /root/requirements.txt /root/requirements-dev.txt

RUN useradd -ms /bin/bash luisalejandro
RUN echo "luisalejandro ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/luisalejandro
RUN useradd -ms /bin/bash luisalejandro

USER luisalejandro

RUN mkdir -p /home/luisalejandro/app

WORKDIR /home/luisalejandro/app

CMD tail -f /dev/null
25 changes: 25 additions & 0 deletions HISTORY.rst
Expand Up @@ -2,6 +2,31 @@ Changelog
============


0.2.2 (2022-04-24)
------------

Changed
~~~~~~~~~~~~

* Adding platform to setup script. [Luis Alejandro Martínez Faneyth]

* Improving documentation. [Luis Alejandro Martínez Faneyth]

* Updating banner. [Luis Alejandro Martínez Faneyth]

* Improving documentation. [Luis Alejandro Martínez Faneyth]


Fixed
~~~~~~~~~~~~

* Fixing tests. [Luis Alejandro Martínez Faneyth]

* Fixing PR tests. [Luis Alejandro Martínez Faneyth]

* Fixing tests. [Luis Alejandro Martínez Faneyth]


0.2.1 (2022-04-22)
------------

Expand Down
2 changes: 1 addition & 1 deletion MAINTAINER.rst
Expand Up @@ -73,7 +73,7 @@ Making a new hotfix
3. Code your hotfix.
4. Bump your version (check everything before next step)::

bumpversion --no-commit --new-version <new version> patch
bumpversion --no-commit <major, minor or patch>

5. Update your changelog (edit HISTORY.rst after to customize)::

Expand Down
10 changes: 6 additions & 4 deletions Makefile
Expand Up @@ -70,13 +70,15 @@ coverage: start
$(BROWSER) htmlcov/index.html

docs:
$(MAKE) -C docs clean
$(MAKE) -C docs html
@docker-compose -p pypicontents -f docker-compose.yml exec \
--user luisalejandro pypicontents make -C docs clean
@docker-compose -p pypicontents -f docker-compose.yml exec \
--user luisalejandro pypicontents make -C docs html
$(BROWSER) docs/_build/html/index.html

servedocs: docs start
@docker-compose -p candyshop -f docker-compose.yml exec \
--user luisalejandro candyshop watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
@docker-compose -p pypicontents -f docker-compose.yml exec \
--user luisalejandro pypicontents watchmedo shell-command -p '*.rst' -c 'make -C docs html' -R -D .

release: clean start dist
twine upload -s -i luis@luisalejandro.org dist/*
Expand Down
84 changes: 11 additions & 73 deletions README.rst
@@ -1,11 +1,11 @@
.. image:: https://github.com/LuisAlejandro/candyshop/blob/develop/docs/_static/banner.svg
.. image:: https://raw.githubusercontent.com/LuisAlejandro/candyshop/develop/docs/_static/banner.svg

..
An assistant to determine if all your dependencies are declared properly in your odoo module.

.. image:: https://img.shields.io/pypi/v/candyshop.svg
:target: https://pypi.python.org/pypi/candyshop
:target: https://pypi.org/project/candyshop
:alt: PyPI Package

.. image:: https://img.shields.io/github/release/LuisAlejandro/candyshop.svg
Expand Down Expand Up @@ -41,7 +41,7 @@
.. _full documentation: https://candyshop.readthedocs.org

Current version: 0.2.1
Current version: 0.2.2

Candyshop is a helper to determine if all your dependencies are declared
properly. A Candyshop is a place where you can pick sweets and candies from
Expand All @@ -67,86 +67,24 @@ Getting started
Installation
------------

.. _PyPI: https://pypi.python.org/pypi/candyshop
.. _PyPI: https://pypi.org/project/candyshop

The ``candyshop`` program is written in python and hosted on PyPI_. Therefore, you can use
pip to install the stable version::

$ pip install --upgrade candyshop
$ pip install --upgrade candyshop

If you want to install the development version (not recomended), you can install
directlty from GitHub like this::

$ pip install --upgrade https://github.com/LuisAlejandro/candyshop/archive/master.tar.gz
$ pip install --upgrade https://github.com/LuisAlejandro/candyshop/archive/master.tar.gz

Usage
-----

Here you can consult practical uses for some of the Candyshop functions.
For a more detailed review on what you can do with it, we recommend you to read
the `api` documentation.
.. _USAGE.rst: USAGE.rst

The ``Module`` class
~~~~~~~~~~~~~~~~~~~~

The ``Module`` class is an abstraction of an Odoo Module. You can perform
several operations to access the module information::

from candyshop.bundle import Module

# Create a Module instance
module = Module('path/to/module')

# Query for data
print(module.path)
print(module.manifest)

# Query information in manifest file
print(module.properties.name)
print(module.properties.version)
print(module.properties.depends)

The ``Bundle`` class
~~~~~~~~~~~~~~~~~~~~

The ``Bundle`` class is an abstraction of a *Group* of modules, often referred
to as *Addons*. Here you can see how to interact with a bundle::

from candyshop.bundle import Bundle

# Create a Bundle instance
bundle = Bundle('path/to/bundle')

# Query for data
print(bundle.name)
print(bundle.path)
print(bundle.modules)
print(bundle.oca_dependencies)

The ``Environment`` class
~~~~~~~~~~~~~~~~~~~~~~~~~

The ``Environment`` class is an abstraction of a virtual Odoo Environment.
Think of it as an imaginary container inside of which you can add ``Bundles``
and ask for specific information about them. For example::

from candyshop.environment import Environment

# Create an Environment
env = Environment()

# Insert bundles
# If any bundle has an oca_dependencies.txt file,
# clone its dependencies and insert them as bundles
env.addbundles(['./path-to-bundle', '../addons', '../etc'])

# Make a report about dependencies that are not present in
# the environment
env.get_notmet_dependencies_report()

# Make a report about record ids that reference modules
# which are not present in the environment
env.get_notmet_record_ids_report()
See USAGE.rst_ for details.

Getting help
============
Expand Down Expand Up @@ -182,10 +120,10 @@ Copyright 2016-2022, Candyshop Developers (read AUTHORS.rst_ for a full list of

Released under a `GPL-3 License`_.

Made with :heart: and :hamburger:
=================================
Made with 💖 and 🍔
====================

.. image:: https://github.com/LuisAlejandro/candyshop/blob/develop/docs/_static/author-banner.svg
.. image:: https://raw.githubusercontent.com/LuisAlejandro/candyshop/develop/docs/_static/author-banner.svg

.. _LuisAlejandroTwitter: https://twitter.com/LuisAlejandro
.. _LuisAlejandroGitHub: https://github.com/LuisAlejandro
Expand Down
74 changes: 74 additions & 0 deletions USAGE.rst
@@ -0,0 +1,74 @@
Usage
-----

Here you can consult practical uses for some of the Candyshop functions.
For a more detailed review on what you can do with it, we recommend you to read
the `api` documentation.

The ``Module`` class
~~~~~~~~~~~~~~~~~~~~

The ``Module`` class is an abstraction of an Odoo Module. You can perform
several operations to access the module information:

.. code-block:: python
from candyshop.bundle import Module
# Create a Module instance
module = Module('path/to/module')
# Query for data
print(module.path)
print(module.manifest)
# Query information in manifest file
print(module.properties.name)
print(module.properties.version)
print(module.properties.depends)
The ``Bundle`` class
~~~~~~~~~~~~~~~~~~~~

The ``Bundle`` class is an abstraction of a *Group* of modules, often referred
to as *Addons*. Here you can see how to interact with a bundle:

.. code-block:: python
from candyshop.bundle import Bundle
# Create a Bundle instance
bundle = Bundle('path/to/bundle')
# Query for data
print(bundle.name)
print(bundle.path)
print(bundle.modules)
print(bundle.oca_dependencies)
The ``Environment`` class
~~~~~~~~~~~~~~~~~~~~~~~~~

The ``Environment`` class is an abstraction of a virtual Odoo Environment.
Think of it as an imaginary container inside of which you can add ``Bundles``
and ask for specific information about them. For example:

.. code-block:: python
from candyshop.environment import Environment
# Create an Environment
env = Environment()
# Insert bundles
# If any bundle has an oca_dependencies.txt file,
# clone its dependencies and insert them as bundles
env.addbundles(['./path-to-bundle', '../addons', '../etc'])
# Make a report about dependencies that are not present in
# the environment
env.get_notmet_dependencies_report()
# Make a report about record ids that reference modules
# which are not present in the environment
env.get_notmet_record_ids_report()
2 changes: 1 addition & 1 deletion candyshop/__init__.py
Expand Up @@ -28,7 +28,7 @@

__author__ = 'Luis Alejandro Martínez Faneyth'
__email__ = 'luis@collagelabs.org'
__version__ = '0.2.1'
__version__ = '0.2.2'
__url__ = 'https://github.com/LuisAlejandro/candyshop'
__description__ = ('Candyshop is a helper to determine if all your '
'dependencies are declared properly.')
6 changes: 1 addition & 5 deletions candyshop/bundle.py
Expand Up @@ -24,7 +24,6 @@
"""

import os
import sys
from ast import literal_eval

from lxml import etree
Expand All @@ -35,9 +34,6 @@
DEFAULT_OCA_USER = 'OCA'
DEFAULT_OCA_BRANCH = '15.0'

if not sys.version_info < (3,):
basestring = str


class Module(object):
"""
Expand Down Expand Up @@ -172,7 +168,7 @@ def get_records_fromfile(self, xmlfile, model=None):
if model:
model_filter = '[@model="{model}"]'.format(model=model)
doc = self.parse_xml_fromfile(xmlfile)
if isinstance(doc, basestring):
if isinstance(doc, str):
return []
return (doc.xpath('/openerp//record' + model_filter) +
doc.xpath('/odoo//record' + model_filter))
Expand Down

0 comments on commit 00597f9

Please sign in to comment.