From: Oleg Broytman Date: Sun, 4 Sep 2016 11:16:36 +0000 (+0300) Subject: Rename mysql2sql -> sqlconvert X-Git-Tag: 0.0.3~3 X-Git-Url: https://git.phdru.name/?p=sqlconvert.git;a=commitdiff_plain;h=159b4e3d7127e719a0dd12013dd54bf05b276ba9 Rename mysql2sql -> sqlconvert --- diff --git a/README.txt b/README.txt index 64b1299..86b1b05 100644 --- a/README.txt +++ b/README.txt @@ -1,11 +1,12 @@ -Broytman mysql to sql converter, Copyright (C) 2016 PhiloSoft Design +Broytman SQL converter, Copyright (C) 2016 PhiloSoft Design Author: Oleg Broytman License: GPL -This is mysql2sql, a mysql to sql converter. Intended primarily to -convert mysqldump (especially with extended INSERT syntax) to standard -SQL to load at least to PostgreSQL or SQLite. +This is sqlconvert, a a library to perform SQL convertions. It uses +sqlparse to parse SQL. -Uses sqlparse to parse SQL. +The library is in its initial phase and currently cannot do much. -The program is in its initial phase and currently cannot do much. +The first goal is to implemet mysq2sql, a script intended primarily to +convert mysqldump output (especially with extended INSERT syntax) to +standard SQL to load at least to PostgreSQL or SQLite. diff --git a/demo/group-file.py b/demo/group-file.py index 5ab1f44..54d1cc2 100755 --- a/demo/group-file.py +++ b/demo/group-file.py @@ -2,8 +2,8 @@ from __future__ import print_function import sys -from mysql2sql.print_tokens import print_tokens -from mysql2sql.process_tokens import requote_names, find_error, \ +from sqlconvert.print_tokens import print_tokens +from sqlconvert.process_tokens import requote_names, find_error, \ StatementGrouper diff --git a/demo/group-sql.py b/demo/group-sql.py index 953e9e7..25493d5 100755 --- a/demo/group-sql.py +++ b/demo/group-sql.py @@ -2,8 +2,8 @@ from __future__ import print_function import sys -from mysql2sql.print_tokens import print_tokens -from mysql2sql.process_tokens import requote_names, find_error, \ +from sqlconvert.print_tokens import print_tokens +from sqlconvert.process_tokens import requote_names, find_error, \ StatementGrouper diff --git a/demo/parse-file.py b/demo/parse-file.py index a701bfe..34a99b7 100755 --- a/demo/parse-file.py +++ b/demo/parse-file.py @@ -3,8 +3,8 @@ from __future__ import print_function import sys from sqlparse import parse -from mysql2sql.print_tokens import print_tokens -from mysql2sql.process_tokens import requote_names, find_error +from sqlconvert.print_tokens import print_tokens +from sqlconvert.process_tokens import requote_names, find_error def main(filename): diff --git a/demo/parse-sql.py b/demo/parse-sql.py index f34178a..cb3f165 100755 --- a/demo/parse-sql.py +++ b/demo/parse-sql.py @@ -3,8 +3,8 @@ from __future__ import print_function import sys from sqlparse import parse -from mysql2sql.print_tokens import print_tokens -from mysql2sql.process_tokens import requote_names, find_error +from sqlconvert.print_tokens import print_tokens +from sqlconvert.process_tokens import requote_names, find_error def main(*queries): diff --git a/docs/Makefile b/docs/Makefile index fc957c0..154937d 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -91,9 +91,9 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/mysql2sql.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/sqlconvert.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/mysql2sql.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/sqlconvert.qhc" .PHONY: applehelp applehelp: @@ -110,8 +110,8 @@ devhelp: @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/mysql2sql" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/mysql2sql" + @echo "# mkdir -p $$HOME/.local/share/devhelp/sqlconvert" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/sqlconvert" @echo "# devhelp" .PHONY: epub diff --git a/docs/conf.py b/docs/conf.py index 2246d74..6b26626 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# mysql2sql documentation build configuration file, created by +# sqlconvert documentation build configuration file, created by # sphinx-quickstart on Fri Jul 22 19:32:24 2016. # # This file is execfile()d with the current directory set to its @@ -51,7 +51,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'mysql2sql' +project = u'sqlconvert' copyright = u'2016, Oleg Broytman' author = u'Oleg Broytman' @@ -136,7 +136,7 @@ html_theme = 'alabaster' # The name for this set of Sphinx documents. # " v documentation" by default. # -# html_title = u'mysql2sql v0.0.1' +# html_title = u'sqlconvert v0.0.1' # A shorter title for the navigation bar. Default is the same as html_title. # @@ -236,7 +236,7 @@ html_static_path = ['_static'] # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'mysql2sqldoc' +htmlhelp_basename = 'sqlconvert_doc' # -- Options for LaTeX output --------------------------------------------- @@ -262,7 +262,7 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'mysql2sql.tex', u'mysql2sql Documentation', + (master_doc, 'sqlconvert.tex', u'sqlconvert Documentation', u'Oleg Broytman', 'manual'), ] @@ -304,7 +304,7 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'mysql2sql', u'mysql2sql Documentation', + (master_doc, 'sqlconvert', u'sqlconvert Documentation', [author], 1) ] @@ -319,8 +319,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'mysql2sql', u'mysql2sql Documentation', - author, 'mysql2sql', 'One line description of project.', + (master_doc, 'sqlconvert', u'sqlconvert Documentation', + author, 'sqlconvert', 'One line description of project.', 'Miscellaneous'), ] diff --git a/docs/genapidocs b/docs/genapidocs index f27f44a..881ecab 100755 --- a/docs/genapidocs +++ b/docs/genapidocs @@ -2,4 +2,4 @@ cd "`dirname $0`"/.. && exec sphinx-apidoc --separate --module-first --suffix=rst --force \ - --output-dir=docs/api mysql2sql + --output-dir=docs/api sqlconvert diff --git a/docs/index.rst b/docs/index.rst index 242918a..46e6c45 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,57 +1,26 @@ -.. mysql2sql documentation master file, created by +.. sqlconvert documentation master file, created by sphinx-quickstart on Fri Jul 22 19:32:24 2016. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to mysql2sql's documentation! +Welcome to sqlconvert's documentation! ===================================== -This is mysql2sql, a mysql to sql converter. It is primary intended to -convert mysqldump (especially with extended INSERT syntax) to standard -SQL to load at least to PostgreSQL or SQLite. - -It uses `sqlparse `_ to parse -SQL. +This is sqlconvert, a library to implenet SQL converters. It uses `sqlparse +`_ to parse SQL. The program is in its initial phase and currently cannot do much. -.. highlight:: none - -Command line ------------- - -mysql2sql -~~~~~~~~~ - -Usage:: - - mysql2sql [-e encoding] [-E output_encoding] [infile] [[-o] outfile] - -Options:: - - -e ENCODING, --encoding ENCODING - input/output encoding, default is utf-8 - -E OUTPUT_ENCODING, --output-encoding OUTPUT_ENCODING - separate output encoding, default is the same as - `-e` except for console; for console output charset - from the current locale is used - -P, --no-pbar Inhibit progress bar - infile Input file, stdin if absent or '-' - -o, --outfile outfile Output file, stdout if absent or '-' - -If stderr is connected to the console the program displays a text mode progress -bar. Option `-P/--no-pbar` inhibits it. - -Option `-o` is useful when infile is absent (input is redirected), for -example:: +The first goal is to implemet `mysq2sql `_, a script intended +primarily to convert mysqldump (especially with extended INSERT syntax) to +standard SQL to load at least to PostgreSQL or SQLite. - mysql2sql -o outfile.sql < infile.sql - cat infile.sql | mysql2sql -o outfile.sql +Contents: -But of course it simply can be:: +.. toctree:: + :maxdepth: 2 - mysql2sql - outfile.sql < infile.sql - cat infile.sql | mysql2sql - outfile.sql + mysq2sql Indices and tables diff --git a/docs/mysql2sql.rst b/docs/mysql2sql.rst new file mode 100644 index 0000000..aba493e --- /dev/null +++ b/docs/mysql2sql.rst @@ -0,0 +1,51 @@ +.. mysql2sql documentation master file, created by + sphinx-quickstart on Fri Jul 22 19:32:24 2016. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to mysql2sql's documentation! +===================================== + +This is mysql2sql, a mysql to sql converter. It is primary intended to +convert mysqldump (especially with extended INSERT syntax) to standard +SQL to load at least to PostgreSQL or SQLite. + +The program is in its initial phase and currently cannot do much. + +.. highlight:: none + +Command line +------------ + +mysql2sql +~~~~~~~~~ + +Usage:: + + mysql2sql [-e encoding] [-E output_encoding] [infile] [[-o] outfile] + +Options:: + + -e ENCODING, --encoding ENCODING + input/output encoding, default is utf-8 + -E OUTPUT_ENCODING, --output-encoding OUTPUT_ENCODING + separate output encoding, default is the same as + `-e` except for console; for console output charset + from the current locale is used + -P, --no-pbar Inhibit progress bar + infile Input file, stdin if absent or '-' + -o, --outfile outfile Output file, stdout if absent or '-' + +If stderr is connected to the console the program displays a text mode progress +bar. Option `-P/--no-pbar` inhibits it. + +Option `-o` is useful when infile is absent (input is redirected), for +example:: + + mysql2sql -o outfile.sql < infile.sql + cat infile.sql | mysql2sql -o outfile.sql + +But of course it simply can be:: + + mysql2sql - outfile.sql < infile.sql + cat infile.sql | mysql2sql - outfile.sql diff --git a/mk-distr b/mk-distr index 50cab8d..88cad9b 100755 --- a/mk-distr +++ b/mk-distr @@ -2,13 +2,13 @@ umask 022 && -git archive --format=tar --prefix=mysql2sql/ "${1:-HEAD}" | +git archive --format=tar --prefix=sqlconvert/ "${1:-HEAD}" | (cd "$HOME/tmp" && exec tar xf -) && -cp -ap docs "$HOME/tmp/mysql2sql" && +cp -ap docs "$HOME/tmp/sqlconvert" && -cd "$HOME/tmp/mysql2sql" && +cd "$HOME/tmp/sqlconvert" && chmod -R u=rwX,go=rX docs && python setup.py sdist --formats=bztar && -cd dist && mv mysql2sql-*.tar.bz2 ../.. && cd ../.. && exec rm -rf mysql2sql +cd dist && mv sqlconvert-*.tar.bz2 ../.. && cd ../.. && exec rm -rf sqlconvert diff --git a/publish-docs b/publish-docs index e4d45a8..5b65ec7 100755 --- a/publish-docs +++ b/publish-docs @@ -1,6 +1,6 @@ #! /bin/sh -web="$HOME"/Internet/WWW/htdocs/phdru.name/Software/Python/mysql2sql/docs +web="$HOME"/Internet/WWW/htdocs/phdru.name/Software/Python/sqlconvert/docs cd "`dirname \"$0\"`"/docs/_build/html && rsync -ahP --del * --exclude=objects.inv "$web" && diff --git a/scripts/mysql2sql b/scripts/mysql2sql index 3809c1b..d3178e9 100755 --- a/scripts/mysql2sql +++ b/scripts/mysql2sql @@ -7,8 +7,8 @@ import os import sys from sqlparse.compat import text_type -from mysql2sql.print_tokens import print_tokens -from mysql2sql.process_tokens import requote_names, StatementGrouper +from sqlconvert.print_tokens import print_tokens +from sqlconvert.process_tokens import requote_names, StatementGrouper from m_lib.defenc import default_encoding from m_lib.pbar.tty_pbar import ttyProgressBar diff --git a/setup.py b/setup.py index b71c267..e5911c8 100755 --- a/setup.py +++ b/setup.py @@ -15,14 +15,14 @@ except ImportError: from distutils.core import setup is_setuptools = False -versionpath = join(abspath(dirname(__file__)), 'mysql2sql', '__version__.py') -load_source('mysql2sql_version', versionpath) +versionpath = join(abspath(dirname(__file__)), 'sqlconvert', '__version__.py') +load_source('sqlconvert_version', versionpath) # Ignore: E402 module level import not at top of file -from mysql2sql_version import __version__ # noqa +from sqlconvert_version import __version__ # noqa -setup(name='mysql2sql', +setup(name='sqlconvert', version=__version__, - description='Broytman mysql2sql', + description='Broytman sqlconvert', long_description=open('README.txt', 'rtU').read(), author='Oleg Broytman', author_email='phd@phdru.name', @@ -42,8 +42,8 @@ setup(name='mysql2sql', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', ], - packages=['mysql2sql'], + packages=['sqlconvert'], package_data={}, - scripts=['scripts/mysql2sql'], + scripts=['scripts/sqlconvert'], requires=['sqlparse', 'm_lib'], ) diff --git a/mysql2sql/__init__.py b/sqlconvert/__init__.py similarity index 100% rename from mysql2sql/__init__.py rename to sqlconvert/__init__.py diff --git a/mysql2sql/__version__.py b/sqlconvert/__version__.py similarity index 100% rename from mysql2sql/__version__.py rename to sqlconvert/__version__.py diff --git a/mysql2sql/print_tokens.py b/sqlconvert/print_tokens.py similarity index 100% rename from mysql2sql/print_tokens.py rename to sqlconvert/print_tokens.py diff --git a/mysql2sql/process_tokens.py b/sqlconvert/process_tokens.py similarity index 100% rename from mysql2sql/process_tokens.py rename to sqlconvert/process_tokens.py diff --git a/tests/test_stgrouper.py b/tests/test_stgrouper.py index d77773e..3354b02 100755 --- a/tests/test_stgrouper.py +++ b/tests/test_stgrouper.py @@ -3,8 +3,8 @@ import unittest -from mysql2sql.print_tokens import tlist2str -from mysql2sql.process_tokens import requote_names, StatementGrouper +from sqlconvert.print_tokens import tlist2str +from sqlconvert.process_tokens import requote_names, StatementGrouper from tests import main diff --git a/tests/test_tokens.py b/tests/test_tokens.py index e7e6b3f..da62e43 100755 --- a/tests/test_tokens.py +++ b/tests/test_tokens.py @@ -4,8 +4,8 @@ import unittest from sqlparse import parse -from mysql2sql.process_tokens import requote_names -from mysql2sql.print_tokens import tlist2str +from sqlconvert.process_tokens import requote_names +from sqlconvert.print_tokens import tlist2str from tests import main