Commit 8ddf0a34 authored by Alessandro Elias's avatar Alessandro Elias
Browse files

Merge branch 'issue/503' into 'develop'

SCRUM#503: add lint to ci and fix lint problems

See merge request !9
parents c8d840f5 5a5ebaed
Pipeline #16934 passed with stages
in 5 minutes and 3 seconds
......@@ -6,13 +6,13 @@ apt-get update && apt-get install -y devscripts
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo $LINE | cut -d' ' -f1)
VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
tar --exclude=debian -czf ${PACKAGE}_${VERSION}.orig.tar.gz package/*
PACKAGE=$(echo "$LINE" | cut -d' ' -f1)
VERSION=$(echo "$LINE" | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
tar --exclude=debian -czf "${PACKAGE}"_"${VERSION}".orig.tar.gz package/*
cd package
cd package || exit
debuild -us -uc
cd ../
cd ../ || exit
mkdir build/
mv ${PACKAGE}* build/
mv "${PACKAGE}"* build/
#!/bin/bash
# shellcheck disable=SC2029
# This script uploads an includes a .deb package in our debian repository.
# The distribution is chosen based on the gitlab-ci stage we are on.
......
## Template para empacotamento utilizando o Gitlab-ci.
stages:
- lint
- build
- test
- deploy
lint_shell:
stage: lint
tags:
- debian-packaging
script:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install wget locales locales-all -y
- locale-gen pt_BR.UTF-8
- export LANG=pt_BR.UTF-8
- scversion="stable" # or "v0.4.7", or "latest"
- wget "https://storage.googleapis.com/shellcheck/shellcheck-$scversion.linux.x86_64.tar.xz"
- tar --xz -xvf "shellcheck-$scversion.linux.x86_64.tar.xz"
- shellcheck() { "shellcheck-$scversion/shellcheck" "$@"; }
- ./.linter_shell.sh
lint_python:
stage: lint
tags:
- debian-packaging
script:
- apt-get update && apt-get install python3-pip -y
- pip3 install -r py_linter_requirements.txt
- ./.linter_python.sh
build:
stage: build
artifacts:
......
#!/bin/bash
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
py_files=$(find . -name "*.py")
exe_files=$(grep -Erl "#\!/usr/bin/python*" --exclude=*.* package)
files="$py_files\n$exe_files"
#find no files
if [[ "$files" == "\n" ]];then
echo -e "${YELLOW}No python files found!${NC}"
exit 0
fi
echo -e "$files" | xargs flake8
rv=$?
if [[ $rv -eq 0 ]];then
echo "AWESOME!No problems found."
exit 0
else
echo -e "Understand errors in: ${BLUE}http://flake8.pycqa.org/en/latest/user/error-codes.html${NC}"
exit 1
fi
#!/bin/bash
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
sh_files=$(find . -name "*.sh")
exe_files=$(grep -Erl "#\!/bin/(bash|sh)" --exclude=*.* package)
files="$sh_files\n$exe_files"
#find no files
if [[ "$files" == "\n" ]];then
echo -e "${YELLOW}No shell files found!${NC}"
exit 0
fi
echo -e "$files"| xargs shellcheck -s bash
rv=$?
if [[ $rv -eq 0 ]];then
echo "AWESOME!No problems found."
exit 0
else
echo -e "Understand errors in: ${BLUE}https://github.com/koalaman/shellcheck/wiki${NC}"
exit 1
fi
......@@ -13,13 +13,14 @@ from optparse import OptionParser
class SlideshowViewer(WebKit.WebView):
'''
A basic GTK widget (WebKit.WebView) which displays a slideshow in the
ubiquity-slideshow format. Feel free to copy and paste this to your application
and customize it as needed.
ubiquity-slideshow format. Feel free to copy and paste this to your
application and customize it as needed.
'''
def __init__(self, path, locale='C', rtl=False, controls=False):
'''
@param path Path to the slideshow, in which the slideshow.conf file is stored.
@param path Path to the slideshow, in which the slideshow.conf file
is stored.
@param locale Ideal locale to use for the slideshow
@param rtl True if the given locale should be displayed right-to-left
'''
......@@ -28,7 +29,8 @@ class SlideshowViewer(WebKit.WebView):
config = ConfigParser()
config.read(os.path.join(self.path, 'slideshow.conf'))
slideshow_main = 'file://' + os.path.join(self.path, 'slides', 'index.html')
slideshow_main = 'file://' + os.path.join(self.path,
'slides', 'index.html')
parameters = []
slideshow_locale = self._find_available_locale(locale)
......@@ -44,16 +46,18 @@ class SlideshowViewer(WebKit.WebView):
settings = self.get_settings()
settings.set_property("enable-default-context-menu", False)
#Recent webkit feature. See <http://trac.WebKit.org/changeset/52087>.
# Recent webkit feature. See <http://trac.WebKit.org/changeset/52087>.
settings.set_property("enable-file-access-from-file-uris", True)
config_width = int(config.get('Slideshow', 'width'))
config_height = int(config.get('Slideshow', 'height'))
self.set_size_request(config_width, config_height)
self.connect('navigation-policy-decision-requested', self._on_navigate_decision)
self.connect('navigation-policy-decision-requested',
self._on_navigate_decision)
self.connect('navigation-requested', self._on_navigate)
self.connect('new-window-policy-decision-requested', self._on_new_window_decision)
self.connect('new-window-policy-decision-requested',
self._on_new_window_decision)
self.connect('create-web-view', self._on_new_window)
'''
......@@ -113,23 +117,30 @@ def progress_increment(progressbar, fraction):
return True
#Main program
# Main program
default_path = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])) , 'build', 'ubuntu')
default_path = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
'build', 'ubuntu')
default_locale = locale.getlocale()[0]
parser = OptionParser()
parser.add_option("-l", "--locale", help="LOCALE to use for the slideshow", metavar="LOCALE", default=default_locale)
parser.add_option("-r", "--rtl", action="store_true", help="use output in right-to-left format")
parser.add_option("-c", "--controls", action="store_true", help="Enable controls in the slideshow (you may need to resize the window)")
parser.add_option("-p", "--path", help="path to the SLIDESHOW which will be presented", metavar="SLIDESHOW", default=default_path)
parser.add_option("-l", "--locale", help="LOCALE to use for the slideshow",
metavar="LOCALE", default=default_locale)
parser.add_option("-r", "--rtl", action="store_true", help="use output in"
" right-to-left format")
parser.add_option("-c", "--controls", action="store_true", help="Enable "
"controls in the slideshow (you may need to resize"
" the window)")
parser.add_option("-p", "--path", help="path to the SLIDESHOW which will be "
"presented", metavar="SLIDESHOW", default=default_path)
(options, args) = parser.parse_args()
options.path = os.path.abspath(options.path)
if not os.path.exists(options.path):
sys.exit("\033[91m * Please build the slideshow content first by using the make command * \033[0m")
sys.exit("\033[91m * Please build the slideshow content"
" first by using the make command * \033[0m")
Gdk.threads_init()
......@@ -150,7 +161,8 @@ slideshow_window.set_resizable(False)
slideshow_container = Gtk.VBox()
slideshow_window.add(slideshow_container)
slideshow = SlideshowViewer(options.path, locale=options.locale, rtl=options.rtl, controls=options.controls)
slideshow = SlideshowViewer(options.path, locale=options.locale,
rtl=options.rtl, controls=options.controls)
install_progressbar = Gtk.ProgressBar()
install_progressbar.set_margin_top(8)
......@@ -169,7 +181,8 @@ slideshow_container.set_child_packing(install_progressbar, True, False, 0, 0)
slideshow_window.show_all()
install_timer = GLib.timeout_add_seconds(2, progress_increment, install_progressbar, 0.01)
install_timer = GLib.timeout_add_seconds(2, progress_increment,
install_progressbar, 0.01)
Gtk.main()
......@@ -21,12 +21,13 @@ def get_subdirs(root):
if os.path.isdir(fpath):
yield fname, fpath
directory = {}
for locale_name, locale_path in get_subdirs(l10n_path):
directory[locale_name] = {
'slides' : [slide for slide in os.listdir(locale_path)],
'media' : []
'slides': [slide for slide in os.listdir(locale_path)],
'media': []
}
directory[locale_name]['slides'].sort()
......
le-ubiquity-slideshow (0.1.3) unstable; urgency=medium
* Adear to lint specifications
-- Rafael Sanfelice Castilho <rsc15@inf.ufpr.br> Tue, 31 Jul 2018 14:58:53 -0300
le-ubiquity-slideshow (0.1.2) testing; urgency=medium
* Insert slide over multiterminal and add dependencies in README
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment