Skip to content

Commit

Permalink
Flake8 CI fixes (#451)
Browse files Browse the repository at this point in the history
* Pep8 fixes

* tox Pep8 compliance

* Excluded external tools folder from flake 8 tests

* Added Flake 8 exclusions

* Pep8 fixes

* Pep8 fixes

* Corrected type

* Pep8 fixes

* Pep 8 compliance

* Pep8 fixes

* Pep8  fixes

* Pep8 fixes

* Pep8 fixes

* Pep 8 fixes

* Pep 8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8

* Pep8

* Pep 8

* Pep 8

* Pep8 fixes

* Pep8

* Pep8

* Pep8

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Revert chagnes

* Revert changes to kivy/__init.py

* Revert changes

* REvert changes

* Revert changes

* Revert changes to toolchain

* Add files exclusions to tox.ini

* Added exclusions for alias recipes

* Remove dead code

* Added py extension to recipes

* Removed recipe build skip

* Improves recipe matching

Previous expression was matching all the following three lines of a `git diff --name-only` output.
```
recipes/hostlibffi/__init__.py
recipes/hostpython.py
recipes/hostpython2/__init__.py
```
This was resulting to a bug when later splitting with `recipe = file_path.split('/')[1]` the `recipes/hostpython.py` string would return including the `\n` new line char, see:
 ```
>>> 'recipes/hostpython.py\n'.split('/')[1]
'hostpython.py\n'
>>> 'recipes/hostlibffi/__init__.py\n'.split('/')[1]
'hostlibffi'
>>> 
```

Co-authored-by: Andre Miras <[email protected]>
  • Loading branch information
Zen-CODE and AndreMiras authored Apr 25, 2020
1 parent 85f849e commit 64bd692
Show file tree
Hide file tree
Showing 46 changed files with 328 additions and 241 deletions.
8 changes: 5 additions & 3 deletions .ci/rebuild_updated_recipes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sh
import shutil
import subprocess
from fnmatch import fnmatch


def modified_recipes(branch='origin/master'):
"""
Expand All @@ -14,14 +15,15 @@ def modified_recipes(branch='origin/master'):
git_diff = sh.contrib.git.diff('--name-only', branch)
recipes = set()
for file_path in git_diff:
if 'recipes/' in file_path:
if fnmatch(file_path, "recipes/*/__init__.py\n"):
recipe = file_path.split('/')[1]
recipes.add(recipe)
return recipes


if __name__ == "__main__":
updated_recipes = " ".join(modified_recipes())
if updated_recipes != '':
subprocess.run(f"python3 toolchain.py build {updated_recipes}", shell=True, check=True)
else:
print("Nothing to do. No updated recipes.")
print("Nothing to do. No updated recipes.")
1 change: 0 additions & 1 deletion recipes/audiostream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ class AudiostreamRecipe(CythonRecipe):


recipe = AudiostreamRecipe()

8 changes: 5 additions & 3 deletions recipes/click/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# pure-python package, this can be removed when we'll support any python package
from toolchain import PythonRecipe, shprint
from os.path import join
import sh, os
import sh
import os


class ClickRecipe(PythonRecipe):
version = "master"
url = "https://github.com/mitsuhiko/click/archive/{version}.zip"
depends = ["python"]

def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
Expand All @@ -20,5 +22,5 @@ def install(self):
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)

recipe = ClickRecipe()

recipe = ClickRecipe()
1 change: 1 addition & 0 deletions recipes/curly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from toolchain import CythonRecipe


class CurlyRecipe(CythonRecipe):
version = "master"
url = "https://github.com/tito/curly/archive/{version}.zip"
Expand Down
5 changes: 1 addition & 4 deletions recipes/cymunk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
E-mail: [email protected], [email protected]
"""

from toolchain import CythonRecipe,shprint
import os
from os.path import join
import sh
from toolchain import CythonRecipe


class CymunkRecipe(CythonRecipe):
Expand Down
5 changes: 4 additions & 1 deletion recipes/distribute/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from toolchain import PythonRecipe, shprint
from os.path import join
import sh, os
import sh
import os


class DistributeRecipe(PythonRecipe):
version = "0.7.3"
Expand All @@ -18,4 +20,5 @@ def install(self):
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)


recipe = DistributeRecipe()
2 changes: 1 addition & 1 deletion recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from toolchain import Recipe, shprint
from os.path import join, exists
from os.path import join
import sh


Expand Down
10 changes: 4 additions & 6 deletions recipes/ffpyplayer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from toolchain import CythonRecipe, shprint
from toolchain import CythonRecipe
from os.path import join
import sh


class FFPyplayerRecipe(CythonRecipe):
Expand All @@ -19,19 +18,18 @@ def get_recipe_env(self, arch):
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
env["SDL_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
"common", "sdl2")
"common", "sdl2")
env["FFMPEG_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
arch.arch, "ffmpeg")
arch.arch, "ffmpeg")
env["CONFIG_POSTPROC"] = "0"
return env

def prebuild_arch(self, arch):
# common to all archs
if self.has_marker("patched"):
if self.has_marker("patched"):
return
self.apply_patch("misc-visibility.patch")
self.set_marker("patched")


recipe = FFPyplayerRecipe()

10 changes: 6 additions & 4 deletions recipes/flask/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# pure-python package, this can be removed when we'll support any python package
from toolchain import PythonRecipe, shprint
from os.path import join
import sh, os
import sh
import os


class FlaskRecipe(PythonRecipe):
version = "master"
url = "https://github.com/mitsuhiko/flask/archive/{version}.zip"
depends = ["python","jinja2","werkzeug","itsdangerous","click"]
depends = ["python", "jinja2", "werkzeug", "itsdangerous", "click"]

def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
Expand All @@ -20,5 +22,5 @@ def install(self):
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)

recipe = FlaskRecipe()

recipe = FlaskRecipe()
1 change: 0 additions & 1 deletion recipes/freetype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ def build_arch(self, arch):


recipe = FreetypeRecipe()

6 changes: 3 additions & 3 deletions recipes/host_setuptools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from toolchain import Recipe, shprint
from os.path import join, exists
from os.path import join
import sh
import os
import fnmatch
import shutil


Expand All @@ -13,7 +12,7 @@ class HostSetuptools(Recipe):

def prebuild_arch(self, arch):
hostpython = sh.Command(self.ctx.hostpython)
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
shprint(hostpython, "./ez_setup.py")
# Extract setuptools egg and remove .pth files. Otherwise subsequent
# python package installations using setuptools will raise exceptions.
Expand All @@ -31,4 +30,5 @@ def prebuild_arch(self, arch):
os.remove('easy-install.pth')
shutil.rmtree('EGG-INFO')


recipe = HostSetuptools()
4 changes: 3 additions & 1 deletion recipes/hostlibffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

logger = logging.getLogger(__name__)


class LibffiRecipe(Recipe):
version = "3.2.1"
url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
Expand All @@ -29,7 +30,7 @@ def prebuild_arch(self, arch):
return
# necessary as it doesn't compile with XCode 6.0. If we use 5.1.1, the
# compiler for i386 is not working.
#shprint(sh.sed,
# shprint(sh.sed,
# "-i.bak",
# "s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=6.0/g",
# "generate-darwin-source-and-headers.py")
Expand Down Expand Up @@ -63,4 +64,5 @@ def build_arch(self, arch):
def postbuild_arch(self, arch):
pass


recipe = LibffiRecipe()
2 changes: 2 additions & 0 deletions recipes/hostpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

logger = logging.getLogger(__name__)


class HostpythonAliasRecipe(Recipe):
is_alias = True

Expand All @@ -24,4 +25,5 @@ def init_after_import(self, ctx):
if hostpython:
self.depends = [hostpython]


recipe = HostpythonAliasRecipe()
2 changes: 2 additions & 0 deletions recipes/hostpython2/_scproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
No proxy is supported yet.
'''


def _get_proxy_settings():
return {'exclude_simple': 1}


def _get_proxies():
return {}
16 changes: 8 additions & 8 deletions recipes/ios/src/setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from distutils.core import setup, Extension
import os


setup(name='ios',
version='1.1',
ext_modules=[
Extension(
'ios', ['ios.c', 'ios_utils.m', 'ios_mail.m', 'ios_browser.m',
'ios_filechooser.m'],
libraries=[ ],
library_dirs=[],
)
]
Extension('ios',
['ios.c', 'ios_utils.m', 'ios_mail.m', 'ios_browser.m',
'ios_filechooser.m'],
libraries=[],
library_dirs=[],
)
]
)
6 changes: 4 additions & 2 deletions recipes/itsdangerous/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# pure-python package, this can be removed when we'll support any python package
from toolchain import PythonRecipe, shprint
from os.path import join
import sh, os
import sh
import os


class ItsDangerousRecipe(PythonRecipe):
version = "master"
Expand All @@ -20,5 +22,5 @@ def install(self):
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)

recipe = ItsDangerousRecipe()

recipe = ItsDangerousRecipe()
8 changes: 5 additions & 3 deletions recipes/jinja2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# pure-python package, this can be removed when we'll support any python package
from toolchain import PythonRecipe, shprint
from os.path import join
import sh, os
import sh
import os


class Jinja2Recipe(PythonRecipe):
version = "master"
url = "https://github.com/mitsuhiko/jinja2/archive/{version}.zip"
depends = ["python","markupsafe"]
depends = ["python", "markupsafe"]

def install(self):
arch = list(self.filtered_archs)[0]
Expand All @@ -20,5 +22,5 @@ def install(self):
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)

recipe = Jinja2Recipe()

recipe = Jinja2Recipe()
Loading

0 comments on commit 64bd692

Please sign in to comment.