diff options
| author | Felix Moessbauer <felix.moessbauer@siemens.com> | 2024-02-13 13:30:25 +0100 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2024-03-13 04:35:54 +0000 |
| commit | 8bf2d3e9a0327130dd17ef5449dda60ec8da7ce0 (patch) | |
| tree | 2158df70f56c27a1c5f2d0abb676fe3b7205d325 | |
| parent | 78047d10cd15e3de62d1443112eb5c2f0ac45864 (diff) | |
| parent | 578290977dfaff131a1c11f773271dba82b4fb4e (diff) | |
0.6.0-1 (patches applied)applied/0.6.0-1applied/ubuntu/resoluteapplied/ubuntu/questing-develapplied/ubuntu/questingapplied/ubuntu/plucky-develapplied/ubuntu/pluckyapplied/ubuntu/oracular-proposedapplied/ubuntu/oracular-develapplied/ubuntu/oracular
Imported using git-ubuntu import.
| -rw-r--r-- | .github/dependabot.yml | 10 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 25 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | airspeed/__init__.py | 6 | ||||
| -rw-r--r-- | debian/changelog | 10 | ||||
| -rw-r--r-- | debian/control | 5 | ||||
| -rwxr-xr-x | debian/rules | 4 | ||||
| -rw-r--r-- | flake.nix | 20 | ||||
| -rwxr-xr-x | setup.py | 2 | ||||
| -rw-r--r-- | tests/__init__.py | 25 |
10 files changed, 102 insertions, 7 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ba29cb1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + commit-message: + prefix: "chore" + include: "scope" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..60fc00a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: ci +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + steps: + - name: checkout + uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '${{ matrix.python-version }}' + + - name: Install dependencies + run: | + pip install six cachetools + + - name: Run tests + run: | + PYTHONPATH=$(pwd) python tests/__init__.py @@ -1,4 +1,4 @@ -[](https://travis-ci.org/purcell/airspeed) +[](https://github.com/purcell/airspeed/actions/workflows/ci.yml) [](https://pypi.org/project/airspeed/) [](https://pypi.org/project/airspeed/) <a href="https://www.patreon.com/sanityinc"><img alt="Support me" src="https://img.shields.io/badge/Support%20Me-%F0%9F%92%97-ff69b4.svg"></a> diff --git a/airspeed/__init__.py b/airspeed/__init__.py index 38de8a3..49f759a 100644 --- a/airspeed/__init__.py +++ b/airspeed/__init__.py @@ -27,7 +27,8 @@ __additional_methods__ = { str: { 'length': lambda self: len(self), 'replaceAll': lambda self, pattern, repl: re.sub(pattern, repl, self), - 'startsWith': lambda self, prefix: self.startswith(prefix) + 'startsWith': lambda self, prefix: self.startswith(prefix), + 'matches': lambda self, pattern: re.match(pattern, self) }, list: { 'size': lambda self: len(self), @@ -36,8 +37,9 @@ __additional_methods__ = { 'add': lambda self, value: self.append(value) }, dict: { + 'isEmpty': lambda self: not bool(self), + 'keySet': lambda self: self.keys(), 'put': lambda self, key, value: self.update({key: value}), - 'keySet': lambda self: self.keys() } } diff --git a/debian/changelog b/debian/changelog index 0d441a9..61ac4bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +python-airspeed (0.6.0-1) unstable; urgency=medium + + * fix package short description + * update debian standards version to 4.6.2 + * add multi-arch specifier + * execute tests with unittest + * New upstream version 0.6.0 + + -- Felix Moessbauer <felix.moessbauer@siemens.com> Tue, 13 Feb 2024 13:30:25 +0100 + python-airspeed (0.5.20-1) unstable; urgency=medium * Team upload diff --git a/debian/control b/debian/control index 4ebcacb..7a44229 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ Build-Depends: debhelper-compat (= 13), python3-all, python3-cachetools, python3-six -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Testsuite: autopkgtest-pkg-python Homepage: https://github.com/purcell/airspeed Vcs-Browser: https://salsa.debian.org/python-team/packages/python-airspeed @@ -18,8 +18,9 @@ Rules-Requires-Root: no Package: python3-airspeed Architecture: all +Multi-Arch: foreign Depends: ${python3:Depends}, ${misc:Depends} -Description: Python Airspeed - a Python template engine +Description: Python template engine Airspeed is a powerful and easy-to-use templating engine for Python that aims for a high level of compatibility with the popular Velocity library for Java. diff --git a/debian/rules b/debian/rules index 4cda55c..47c6698 100755 --- a/debian/rules +++ b/debian/rules @@ -4,3 +4,7 @@ export PYBUILD_NAME = airspeed %: dh $@ --with python3 --buildsystem=pybuild + +override_dh_auto_test: + python3 -m unittest + diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..dcfc5e1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + description = "Airspeed"; + + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }@inputs: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ poetry poetry2nix (python37.withPackages (p: [ p.setuptools p.six ])) python37Packages.flake8 python310Packages.pylint ]; + }; + } + ); +} @@ -12,7 +12,7 @@ if sys.version_info <= (2, 6): setup( name="airspeed", - version="0.5.20", + version="0.6.0", description=("Airspeed is a powerful and easy-to-use templating engine" " for Python that aims for a high level of compatibility " "with the popular Velocity library for Java."), diff --git a/tests/__init__.py b/tests/__init__.py index 37a6894..c3d723d 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1250,7 +1250,20 @@ line")''') self.assertEqual(output, " yes!") def test_string_starts_with_false(self): - template = airspeed.Template("#set($foo = 'nofoobar123') #if($foo.startsWith('foo'))yes!#end") + template = airspeed.Template( + "#set($foo = 'nofoobar123') #if($foo.startsWith('foo'))yes!#end") + output = template.merge({}) + self.assertEqual(output, " ") + + def test_string_matches_true(self): + template = airspeed.Template( + "#set($foo = 'nofoobar123') #if($foo.matches('.*foo.*'))yes!#end") + output = template.merge({}) + self.assertEqual(output, " yes!") + + def test_string_matches_false(self): + template = airspeed.Template( + "#set($foo = 'bar') #if($foo.matches('foo'))yes!#end") output = template.merge({}) self.assertEqual(output, " ") @@ -1260,6 +1273,16 @@ line")''') output = template.merge({'test_dict': {'k': 'initial value'}}) self.assertEqual(output, "new value") + def test_dict_isEmpty(self): + template = airspeed.Template("#set( $emptyDict = {} )" + "$emptyDict.isEmpty()") + output = template.merge({}) + self.assertEqual(output, "True") + + template = airspeed.Template("#set( $emptyDict = {'foo': 'bar'} )" + "$emptyDict.isEmpty()") + output = template.merge({}) + self.assertEqual(output, "False") def test_evaluate(self): template = airspeed.Template('''#set($source1 = "abc") |
