Kaydet (Commit) 41742abe authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

inary shell rewriting

üst fbbf3768
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.7
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/zaryob/Repositories/inary/tests/helloworld/helloworld
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/zaryob/Repositories/inary
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/zaryob/Repositories/inary/CMakeFiles /home/zaryob/Repositories/inary/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/zaryob/Repositories/inary/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named helloworld
# Build rule for target.
helloworld: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 helloworld
.PHONY : helloworld
# fast build rule for target.
helloworld/fast:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/build
.PHONY : helloworld/fast
src/helloworld.o: src/helloworld.cxx.o
.PHONY : src/helloworld.o
# target to build an object file
src/helloworld.cxx.o:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/src/helloworld.cxx.o
.PHONY : src/helloworld.cxx.o
src/helloworld.i: src/helloworld.cxx.i
.PHONY : src/helloworld.i
# target to preprocess a source file
src/helloworld.cxx.i:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/src/helloworld.cxx.i
.PHONY : src/helloworld.cxx.i
src/helloworld.s: src/helloworld.cxx.s
.PHONY : src/helloworld.s
# target to generate assembly for a file
src/helloworld.cxx.s:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/src/helloworld.cxx.s
.PHONY : src/helloworld.cxx.s
src/utility.o: src/utility.cxx.o
.PHONY : src/utility.o
# target to build an object file
src/utility.cxx.o:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/src/utility.cxx.o
.PHONY : src/utility.cxx.o
src/utility.i: src/utility.cxx.i
.PHONY : src/utility.i
# target to preprocess a source file
src/utility.cxx.i:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/src/utility.cxx.i
.PHONY : src/utility.cxx.i
src/utility.s: src/utility.cxx.s
.PHONY : src/utility.s
# target to generate assembly for a file
src/utility.cxx.s:
$(MAKE) -f CMakeFiles/helloworld.dir/build.make CMakeFiles/helloworld.dir/src/utility.cxx.s
.PHONY : src/utility.cxx.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... install/strip"
@echo "... install/local"
@echo "... helloworld"
@echo "... rebuild_cache"
@echo "... edit_cache"
@echo "... install"
@echo "... list_install_components"
@echo "... src/helloworld.o"
@echo "... src/helloworld.i"
@echo "... src/helloworld.s"
@echo "... src/utility.o"
@echo "... src/utility.i"
@echo "... src/utility.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
......@@ -5,7 +5,7 @@ Pisi çatalı: Copyright (C) 2005 - 2011, Tubitak/UEKAE
GNU/Genel Kamu Lisansı sürüm 2 ile lisanslanmıştır.
Inary çatalı ve geliştirmeleri: Copyright (C) 2016 - 2018 Suleyman POYRAZ (Zaryob)
Lisansı GNU/Genel Kamu Lisansı sürüm 3' yükseltilmiştir.
Lisansı GNU/Genel Kamu Lisansı sürüm 3'e yükseltilmiştir.
......@@ -40,5 +40,3 @@ Diğer özellikleri:
- Basit düzey ve üst düzey tüm işlemleri aynı kararlılıkla yerine getirir
- Forend uygulamaları tasarlanmasına elverişli bir yapıdadır.
- Terminal arayüzü oldukça anlaşılır ve kullanıcı dostudur.
......@@ -148,7 +148,9 @@ Legend:
+ read pkgconfig files and find dependencies (Zaryob)
+ find cycle dependencies (Zaryob)
- Automatic build upgrader
/ creating pspec files from shell script type
- pykde & pygtk GUI (cartman)
+ pykde interface (used package-manager)
+ improve interface (eray)
+ refactor UI, reintroduce base class
+ add an ack interface, start cleaning up a bit
......@@ -221,7 +223,7 @@ Legend:
/ package signing
/ an embebed package signer.(Zaryob)
+ a flag to sign package after building
/ code to check if the package has a valid signature
+ code to check if the package has a valid signature
- cli improvements
- non interactive mode (similar to --auto in urpmi)
/ high-level build commands
......
* Lookup cleanCache function. Understand "How it works and How we can use it in inary"
* When scom errored inary should be add package to pending orders.
* Looking up messages and translations
* atomicoperations will part for understandabling
......@@ -61,6 +61,9 @@ def handle_exception(exception, value, tb):
elif isinstance(value, KeyboardInterrupt):
ui.error(_("\nKeyboard Interrupt: Exiting..."))
exit()
elif isinstance(value, EOFError):
ui.error(_("\nKeyboard Interrupt [Ctrl-D]: Exiting..."))
exit()
elif isinstance(value, inary.errors.Exception):
show_traceback = True
ui.error(_("\nUnhandled internal exception.\n"
......
......@@ -59,6 +59,8 @@ class XmlFile(object):
def parsexml(self, file):
try:
if type(file)==bytes:
file.decode('utf-8')
self.doc = iks.parseString(str(file))
return self.doc
except Exception as e:
......
......@@ -22,60 +22,101 @@ import inary.context as ctx
from inary.cli.inarycli import InaryCLI
import gettext
gettext.bindtextdomain('inary', "/usr/share/locale")
gettext.textdomain('inary')
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
try:
import ciksemel
except:
#FIXME: Gorunusu guzel olsa bile kodda anlamsizlik yaratiyor
warn = inary.util.colorize(_("WARNING:\n"),"blinkingred")+ \
inary.util.colorize(_("\tCiksemel XML Parser not found!!!\n"
"\tMinidom slower but\n"
"\tFalling back with minidom!!! :(\n\n"), 'faintwhite')
sys.stdout.write(warn)
def exit(retval = 0):
sys.exit(retval)
if __name__ == "__main__":
locale.setlocale(locale.LC_ALL, '')
ctx.ui.info(_("""Welcome to the interactive INARY shell.
Type "help" to see a list of commands.
To end the session, type "exit".
You can run system commands by prefixing with '!' as in '!ls'.
Copyright 2018 (c) Zaryob and Sulin Community. """))
while 1:
cmd = input('inary> ')
if cmd.strip()=='exit':
ctx.ui.info(_('Bye!'))
def sig_handler(sig, frame):
if sig == signal.SIGTERM:
exit()
if cmd.startswith('!'):
cmd = cmd[1:]
os.system(cmd)
continue
try:
cli = InaryCLI(cmd.split())
cli.run_command()
except inary.errors.Exception as e:
pass
except Exception as value:
def handle_exception(exception, value, tb):
signal.signal(signal.SIGINT, signal.SIG_IGN) # disable further interrupts
ui = inary.cli.CLI() # make a temporary UI
show_traceback = False
if isinstance(value, KeyboardInterrupt):
ui.error(_("Keyboard Interrupt: Exiting..."))
elif isinstance(value, inary.errors.Error):
ui.error(_("Program Terminated."))
show_traceback = ctx.get_option('debug')
if isinstance(value, inary.errors.Error):
ui.error(_("\nProgram terminated."))
elif isinstance(value, KeyboardInterrupt):
ui.error(_("\nKeyboard Interrupt: Exiting..."))
exit()
elif isinstance(value, EOFError):
ui.error(_("\nKeyboard Interrupt [Ctrl-D]: Exiting..."))
exit()
elif isinstance(value, inary.errors.Exception):
show_traceback = True
ui.error(_("""Unhandled internal exception. Please file a bug report.
(http://bugs.sulin.org)"""))
ui.error(_("\nUnhandled internal exception.\n"
"Please file a bug report to <http://bugs.sulin.org>."))
elif isinstance(value, IOError) and value.errno == errno.EPIPE:
# Ignore broken pipe errors
sys.exit(0)
else:
# For any other exception (possibly Python exceptions) show the traceback!
# For any other exception (possibly Python exceptions) show
# the traceback!
show_traceback = ctx.get_option('debug')
ui.error(_("System Error. Program Terminated."))
ui.error(_("\nSystem error. Program terminated."))
if ctx.get_option('debug'):
ui.error(u"{}: {}".format(exception, value))
if show_traceback:
ui.error("{}: {}".format(exception, str(value)))
else:
ui.error(str(value))
msg = str(value)
if msg:
ui.error(msg)
ui.info(_("Please type 'help' for general help."))
ui.info(_("Please use 'inary help' for general help."))
if show_traceback:
ui.info(_("Traceback:"))
traceback.print_tb(sys.exc_traceback)
else:
ui.info(_("\nTraceback:"))
traceback.print_tb(tb)
elif not isinstance(value, inary.errors.Error):
ui.info(_("Use --debug to see a traceback."))
exit()
if __name__ == "__main__":
locale.setlocale(locale.LC_ALL, '')
sys.excepthook = handle_exception
signal.signal(signal.SIGTERM, sig_handler)
ui = inary.cli.CLI() # make a temporary UI
ui.info(_("Welcome to the interactive INARY shell.\n"
"Type 'help' to see a list of commands.\n"
"To end the session, type 'exit'.\n"
"You can run system commands by prefixing with '!' as in '!ls'.\n\n"
" Copyright 2005-2011, Tubitak/UEKAE\n"
" Copyright 2018 (c) Zaryob and Sulin Community.\n\n"))
while 1:
sys.excepthook = handle_exception
cmd = input('inary >> ')
if cmd.strip()=='exit':
ctx.ui.info(_('Bye!'))
exit()
if cmd.startswith('!'):
cmd = cmd[1:]
if cmd.startswith('bash') or\
cmd.startswith('zsh') or\
cmd.startswith('sh'):
ui.error(_("Can not use an other SHELL in Inary Shell"))
else:
os.system(cmd)
continue
cli = InaryCLI(cmd.split())
cli.run_command()
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