diff --git a/SwigPython.make b/SwigPython.make deleted file mode 100644 index ef61464e..00000000 --- a/SwigPython.make +++ /dev/null @@ -1,97 +0,0 @@ -## -## Auto Generated makefile by CodeLite IDE -## any manual changes will be erased -## -## Debug -ProjectName :=SwigPython -ConfigurationName :=Debug -IntermediateDirectory := $(CCDB_HOME)/tmp -OutDir := $(IntermediateDirectory) -WorkspacePath := "/media/sf_ccdb/ccdb/projects/CodeLite" -ProjectPath := "/media/sf_ccdb/ccdb/projects/CodeLite" -CurrentFileName := -CurrentFilePath := -CurrentFileFullPath := -User :=romanov -Date :=01/31/2011 -CodeLitePath :="/home/romanov/.codelite" -LinkerName :=g++ -ArchiveTool :=ar rcus -SharedObjectLinkerName :=g++ -shared -fPIC -ObjectSuffix :=.o -DependSuffix :=.o.d -PreprocessSuffix :=.o.i -DebugSwitch :=-gstab -IncludeSwitch :=-I -LibrarySwitch :=-l -OutputSwitch :=-o -LibraryPathSwitch :=-L -PreprocessorSwitch :=-D -SourceSwitch :=-c -CompilerName :=g++ -C_CompilerName :=gcc -OutputFile :=$(CCDB_HOME)/python/ccdb/ccdb_pyllapi/_ccdb_pyllapi.so -Preprocessors := -ObjectSwitch :=-o -ArchiveOutputSwitch := -PreprocessOnlySwitch :=-E -MakeDirCommand :=mkdir -p -CmpOptions :=$(shell mysql_config --cflags) $(shell python-config --cflags) -shared -g -fPIC $(Preprocessors) -C_CmpOptions := -g $(Preprocessors) -fPIC -LinkOptions := $(shell mysql_config --libs) $(shell python-config --libs) -shared -IncludePath := "$(IncludeSwitch)." "$(IncludeSwitch)$(CCDB_HOME)/include" "$(IncludeSwitch)/usr/include/python2.7" "$(IncludeSwitch)." -RcIncludePath := -Libs :=$(LibrarySwitch)ccdb -LibPath := "$(LibraryPathSwitch)$(CCDB_HOME)/lib" - - -## -## User defined environment variables -## -CodeLiteDir:=/usr/share/codelite -Objects=$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(ObjectSuffix) - -## -## Main Build Targets -## -all: $(OutputFile) - -$(OutputFile): makeDirStep $(Objects) - @$(MakeDirCommand) $(@D) - $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) $(Objects) $(LibPath) $(Libs) $(LinkOptions) - @echo Executing Post Build commands ... - cp $(CCDB_HOME)/swig/ccdb_pyllapi.py $(CCDB_HOME)/python/ccdb/ccdb_pyllapi - @echo Done - -makeDirStep: - @test -d $(IntermediateDirectory) || $(MakeDirCommand) $(IntermediateDirectory) - -PreBuild: - @echo Executing Pre Build commands ... -# swig -c++ -classic -python $(CCDB_HOME)/swig/ccdb_pyllapi.i - @echo Done - - -## -## Objects -## -$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(ObjectSuffix): $(CCDB_HOME)/swig/ccdb_pyllapi_wrap.cxx $(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(DependSuffix) - $(CompilerName) $(SourceSwitch) "$(CCDB_HOME)/swig/ccdb_pyllapi_wrap.cxx" $(CmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(ObjectSuffix) $(IncludePath) -$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(DependSuffix): $(CCDB_HOME)/swig/ccdb_pyllapi_wrap.cxx - @$(CompilerName) $(CmpOptions) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(ObjectSuffix) -MF$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(DependSuffix) -MM "$(CCDB_HOME)/swig/ccdb_pyllapi_wrap.cxx" - -$(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(PreprocessSuffix): $(CCDB_HOME)/swig/ccdb_pyllapi_wrap.cxx - @$(CompilerName) $(CmpOptions) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(PreprocessSuffix) "$(CCDB_HOME)/swig/ccdb_pyllapi_wrap.cxx" - - --include $(IntermediateDirectory)/*$(DependSuffix) -## -## Clean -## -clean: - $(RM) $(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(ObjectSuffix) - $(RM) $(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(DependSuffix) - $(RM) $(IntermediateDirectory)/swig_ccdb_pyllapi_wrap$(PreprocessSuffix) - $(RM) $(OutputFile) - - diff --git a/find_ccdb_usages.py b/find_ccdb_usages.py deleted file mode 100644 index fe6a067c..00000000 --- a/find_ccdb_usages.py +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/python - -import os -import stat - -def walktree (top = ".", depthfirst = True): - names = os.listdir(top) - if not depthfirst: - yield top, names - for name in names: - try: - st = os.lstat(os.path.join(top, name)) - except os.error: - continue - if stat.S_ISDIR(st.st_mode): - for (newtop, children) in walktree (os.path.join(top, name), depthfirst): - yield newtop, children - if depthfirst: - yield top, names - -for (basepath, children) in walktree(".",False): - for child in children: - print os.path.join(basepath, child) - -dirs_to_search = [x[0] for x in os.walk('.') if not ".svn" in x[0]] - - \ No newline at end of file diff --git a/install.windows.txt b/install.windows.txt deleted file mode 100644 index 7f09dc04..00000000 --- a/install.windows.txt +++ /dev/null @@ -1,111 +0,0 @@ -GENERAL -======= -This manual will help you to use Visual Studio 2010 to develop CCDB package. It is EASY to do this on Windows, and the only requirment to install some additional FREE tools and setup some variables. - - - -1. INSTALL TOOLS -================ -We assume that you use VS2010 for development. VS2010 C++ Express is free. Our recomendation is to use VS2010 pro + Whole Tomato Visual Assist X, you can try both for 60 days for free and then decide. VS2010 C++ Express + Visual Assist X will work too. JUST TRY IT. [VS2010 compare](http://www.microsoft.com/visualstudio/en-us/products/2010-editions/product-comparison#expressCompareTable) here is detailed comparision of different Visual Studio versions with links to download. Configuring other IDEs on Windows would be merelly the same. - -So... You have to install next software (all is free and mostly open source). Choose x86 versions for now: - -* [Python 2.7 x86](http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi) -* [pyreadline for windows](https://launchpad.net/pyreadline/+download) -* [MySQL-python-1.2.3.win32-py2.7] (http://sourceforge.net/projects/mysql-python/files/latest/download) -* [Python tools for VS2010](http://pytools.codeplex.com/releases) - to open VS2010 python project -* [MySQL community server](http://dev.mysql.com/downloads/mysql/) -* [MySQL Connector C x86](http://dev.mysql.com/downloads/connector/c/) -* [MySQL workbench](http://dev.mysql.com/downloads/workbench/) this is optional but very helpfull tool -* [tortoise svn](http://tortoisesvn.net/downloads.html) - dont reboot as it asks. Reboot in the end. - -(!) It is relevant to install x86 versions of the packages - - -2. GET SOURCES -============== -To use tortoise svn click right button on a folder you would like CCDB to be checked out in, choose "SVN Checkout" in the context menu. - -Ccdb trunk is -https://phys12svn.jlab.org/repos/trunk/ccdb - - - -3. ENVIRONMENT -============== - -3 environment variables must be set in order to compile swig with VS2010. Swig and Python should be in PATH variable. -It is optional to include MySQL connector incluydto the path too. - -CCDB_HOME - pointing to the ccdb root directory. (directory containing this file and folders: bin, lib, src, etc.) -PYTHON_INCLUDE - the directory that contains python.h -PYTHON_LIB - the python library including path for linking - -Start -> Edit environment variables for your account *-> Set there: - - ++------------------++---------------------------------------------------------- - || || - || NAME || VALUE - ++------------------++---------------------------------------------------------- - || || - || CCDB_HOME || C:\Your\Path\To\CCDB\home - || || - || PATH || C:\Swig; C:\Python27; - || || - || PYTHON_INCLUDE || C:\Python27\include - || || - || PYTHON_LIB || c:\Python27\python27.lib - || || - || MYSQL_CONNECTOR || C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\ - || || - ++------------------++---------------------------------------------------------- - -(!) Dont forget to change this directories to yours! =) - -* - just press 'start' and put 'environ' in the search bar - -Tortoise svn asks to reboot. Thus reboot would do. - -(***) One optional environment is JANA_HOME, VS2010 Jana project use it for autocomplition of Jana classes -No any other goal for this variable. One is free to set it or not - - - -4. MySQL -======== - -Run mysql-workbench. -The workbench project is located in %CCDB_HOME\mysql -in mysqlworkbench press - - - -5. VS2010 PROJECT AND TEST -========================== - -The VS2010 project is located in: - -%CCDB_HOME%\projects\VisualStudio\CCDB.sln - -4.1) Directories of mysql connector are "entered directly" in VS2010 projects. Check that properties: - -Configuration properties->C/C++->Additional include directories -Configuration properties->Librarian->Additional Library directories - -for projects CCDBLibrary, CCDBTests, PythonWrapping pointing to a real directory - - -4.2) Your enviroment is stored in CCDB.suo file wich is not included in the svn (it is Your enviroment), so you may have to: -a) In the Solution Explorer (place where files are listed) -b) click right mouse button on CCDBTests project -c) click "Set as SturtUp Project" - - -press ctrl+F5 to run the project. - - - -6. CONTACTS -=========== - -Is you have any questions, ideas, complains or suggestions feel free to email me to romanov at jlab.org diff --git a/python/.idea/dataSources.xml b/python/.idea/dataSources.xml new file mode 100644 index 00000000..46f7750e --- /dev/null +++ b/python/.idea/dataSources.xml @@ -0,0 +1,19 @@ + + + + + mysql + true + com.mysql.jdbc.Driver + jdbc:mysql://hallddb.jlab.org:3306/ccdb + + + + + + + + + + + \ No newline at end of file diff --git a/python/.idea/misc.xml b/python/.idea/misc.xml index 09f2f019..4feea759 100644 --- a/python/.idea/misc.xml +++ b/python/.idea/misc.xml @@ -342,7 +342,7 @@ jar:file:\C:\Program Files (x86)\JetBrains\PyCharm 2.6.1\lib\pycharm.jar!\resources\html5-schema\html5.rnc - + - + diff --git a/python/.idea/workspace.xml b/python/.idea/workspace.xml index 229bf351..bc251182 100644 --- a/python/.idea/workspace.xml +++ b/python/.idea/workspace.xml @@ -1,14 +1,22 @@ - + + + + + + + + + - + - + + + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -68,37 +185,52 @@ + + + mysql_connection_str + _connection_str + UtilityArgumentParser + _ + __ + __fun + __fu + __fut + __futu + __futur + __future + __future_ + __future__ + + - - + + true + DEFINITION_ORDER - - - - - - - - - - + @@ -109,12 +241,14 @@ - + + + @@ -122,6 +256,10 @@ @@ -132,6 +270,10 @@ + + @@ -143,143 +285,67 @@ - + + + + + + + + + + + + + + - - - + - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - + + + + + + + + + @@ -318,6 +449,19 @@ + + + + + + + + + + + + + @@ -365,18 +509,39 @@ - + + 1448034016529 1449086407184 1449086563289 - + + + + + + + + + + + + + + + + + - + - - + - + + - - - - + + + + + + - + + + + + - @@ -557,24 +770,255 @@ - - + + - - + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/python/ccdb/cmd/utils/__init__.py b/python/ccdb/cmd/utils/__init__.py new file mode 100644 index 00000000..f139d6b2 --- /dev/null +++ b/python/ccdb/cmd/utils/__init__.py @@ -0,0 +1,3 @@ +# Hey! + + diff --git a/python/ccdb/cmd/utils/log.py b/python/ccdb/cmd/utils/log.py index 62a30cac..a2361dcf 100644 --- a/python/ccdb/cmd/utils/log.py +++ b/python/ccdb/cmd/utils/log.py @@ -4,7 +4,7 @@ import ccdb from ccdb import TextFileDOM from ccdb import AlchemyProvider -from ccdb.cmd import ConsoleUtilBase +from ccdb.cmd import ConsoleUtilBase, UtilityArgumentParser from ccdb.model import LogRecord from ccdb import BraceMessage as LogFmt @@ -74,7 +74,15 @@ def process(self, args): " %-18s"%log_record.created.strftime("%Y-%m-%d %H-%M-%S ") + " " +\ log_record.description - + def process_arguments(args): + # utility argument parser is argparse which raises errors instead of exiting app + parser = UtilityArgumentParser() + parser.add_argument("raw_path", nargs='?', default="") + parser.add_argument("-x", "--dtree", action="store_true") + parser.add_argument("-d", "--directories", action="store_true") + parser.add_argument("-t", "--tables", action="store_true") + parser.add_argument("-v", "--variations", action="store_true") + parser.add_argument("-l", "--extended", action="store_true") diff --git a/python/ccdb/provider.py b/python/ccdb/provider.py index 4e5ef092..d957cecc 100644 --- a/python/ccdb/provider.py +++ b/python/ccdb/provider.py @@ -1499,6 +1499,7 @@ def create_log_record(self, user, affected_ids, action, description, comment): def get_log_records(self, limit=20, offset=0): + """ Get log records sorted from now to the past @@ -1515,16 +1516,16 @@ def get_log_records(self, limit=20, offset=0): if limit < 0: limit = 0 - #initial query + # initial query query = self.session.query(LogRecord).order_by(desc(LogRecord.id)) - #add limits to query + # add limits to query if limit != 0: query = query.limit(limit) if offset != 0: query = query.offset(offset) - #execute and return + # execute and return return query.all()