Skip to content

Commit

Permalink
WL7716: Move commercial files and distribution to CPYINT
Browse files Browse the repository at this point in the history
The files related to the commercial distribution move to a new
internal repository (known as CPYINT). We also move all custom
Distutils commands for the creation of packages distributed by Oracle
to CPYINT.

If the Git submodule cpyint is available, setup.py has access the
custom Distutils commands to create GPL and commercial packages.

Overview of files which we rename, remove or move to the CPYINT
repository:

  AUTHORS -> (removed)
  ChangeLog -> CHANGES.txt
  README -> README.txt
  COPYING -> LICENSE.txt
  README_com.txt -> cpyint/data/commercial/README_COM.txt
  LICENSE_com.txt -> cpyint/data/commercial/LICENSE_COM.txt
  metasetupinfo.py -> setupinfo.py and cpyint/metasetupinfo.py
  docs/mysql* -> (removed)
  support/Debian -> cpyint/data/Debian
  support/RPM -> cpyint/data/RPM
  support/OSX -> cpyint/data/OSX
  support/MSWindows -> cpyint/data/MSWindows
  support/scripts/* -> cpyint/scripts/
  version.py -> python2/mysql/connector/version.py
                python3/mysql/connector/version.py
  • Loading branch information
Geert Vanderkelen committed May 22, 2014
1 parent e22f398 commit d889f08
Show file tree
Hide file tree
Showing 132 changed files with 38,602 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -5,4 +5,9 @@
commit.txt
*.patch
*.diff

dist/
build/
MANIFEST
cpy_server*/
*_output.txt
tests_*.log
19 changes: 19 additions & 0 deletions CHANGES.txt
@@ -0,0 +1,19 @@
================================================
MySQL Connector/Python - Release Notes & Changes
================================================

MySQL Connector/Python
Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.

Full release notes:
http://dev.mysql.com/doc/relnotes/connector-python/en/


v2.0.0a1
========

Released on (not yet released)

* (features + bug fixes)


347 changes: 347 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions MANIFEST.in
@@ -0,0 +1,26 @@
include README.txt
include LICENSE.txt
include CHANGES.txt
include setup.py
include setupinfo.py
include version.py
include unittests.py
include MANIFEST.in

include python2/__init__.py
recursive-include python2/examples *.py
recursive-include python2/mysql *.py

include python3/__init__.py
recursive-include python3/mysql *.py
recursive-include python3/examples *.py

include python23/__init__.py
recursive-include python23/django *.py
recursive-include python23/fabric *.py
recursive-include python23/tests23 *.py

recursive-include tests *.py *.csv pylint*.rc *.pem

include docs/README_DOCS.txt

49 changes: 49 additions & 0 deletions README.txt
@@ -0,0 +1,49 @@
==========================
MySQL Connector/Python 2.0
==========================

License
=======

This is a release of MySQL Connector/Python, Oracle's dual-
license Python Driver for MySQL. For the avoidance of
doubt, this particular copy of the software is released
under the version 2 of the GNU General Public License.
MySQL Connector/Python is brought to you by Oracle.

Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.

License information can be found in the LICENSE.txt file.

MySQL FOSS License Exception
We want free and open source software applications under
certain licenses to be able to use the GPL-licensed MySQL
Connector/Python (specified GPL-licensed MySQL client libraries)
despite the fact that not all such FOSS licenses are
compatible with version 2 of the GNU General Public License.
Therefore there are special exceptions to the terms and
conditions of the GPLv2 as applied to these client libraries,
which are identified and described in more detail in the
FOSS License Exception at
<http://www.mysql.com/about/legal/licensing/foss-exception.html>

This software is OSI Certified Open Source Software.
OSI Certified is a certification mark of the Open Source Initiative.

This distribution may include materials developed by third
parties. For license and attribution notices for these
materials, please refer to the documentation that accompanies
this distribution (see the "Licenses for Third-Party Components"
appendix) or view the online documentation at
<http://dev.mysql.com/doc/>
A copy of the license/notices is also reproduced below.

GPLv2 Disclaimer
For the avoidance of doubt, except that if any license choice
other than GPL or LGPL is available it will apply instead,
Oracle elects to use only the General Public License version 2
(GPLv2) at this time for any software where a choice of GPL
license versions is made available with the language indicating
that GPLv2 or any later version may be used, or where a choice
of which version of the GPL is applied is otherwise unspecified.

2 changes: 1 addition & 1 deletion cpyint
9 changes: 9 additions & 0 deletions docs/README_DOCS.txt
@@ -0,0 +1,9 @@
The manual of MySQL Connector/Python is available online here:

http://dev.mysql.com/doc/connector-python/en/index.html


It is also available for download in various formats here:

http://dev.mysql.com/doc/index-connectors.html

Empty file added python2/__init__.py
Empty file.
Empty file added python2/examples/__init__.py
Empty file.
144 changes: 144 additions & 0 deletions python2/examples/client.py
@@ -0,0 +1,144 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.

# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptions to the terms and
# conditions of the GPLv2 as it is applied to this software, see the
# FOSS License Exception
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

"""
Simple CLI using the Connector/Python. It does not take arguments so
you'll need to set the proper login information manually.
Example output:
$ ./client.py
Welcome to MySQL Python CLI.
Your MySQL connection ID is 21.
Server version: 5.0.62-enterprise-gpl
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(MySQLConsole)
>>> show tables;
1046 (3D000): No database selected
>>> use test;
>>> show tables;
>>> create table t1 (id int);
>>> show tables;
(u't1')
"""

from __future__ import print_function

import sys
import os
import readline
import code
import atexit
import re

# We're actually just a demo and supposed to run in the source directory.
sys.path.append('.')

import mysql.connector

class MySQLConsole(code.InteractiveConsole):
mysql = None
regexp = {}

def __init__(self, mysql, locals=None, filename="<console>",
histfile=os.path.expanduser("~/.mysql_history")):
code.InteractiveConsole.__init__(self)
self.init_history(histfile)
self.mysql = mysql

self.regexp['USE'] = re.compile('USE (\w*)', re.IGNORECASE)

def init_history(self, histfile):
readline.parse_and_bind("tab: complete")
if hasattr(readline, "read_history_file"):
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(self.save_history, histfile)

def save_history(self, histfile):
readline.write_history_file(histfile)

def send_query(self, line):
rows = ()
try:
cursor = self.mysql.cursor()
cursor.execute(line)
except mysql.connector.errors.Error as e:
print(e.errmsglong)
return

try:
rows = cursor.fetchall()
for row in rows:
print(row)
except:
pass

def _do_use(db):
try:
my.cmd_init_db(db)
except mysql.connector.errors.InterfaceError as e:
print(e)

def push(self, line):
try:
res = self.regexp['USE'].findall(line)
db = res[0]
self._do_use(db)
except:
pass
self.send_query(line)
code.InteractiveConsole(self, line)


if __name__ == '__main__':

print("Welcome to MySQL Python CLI.")

try:
db = mysql.connector.Connect(unix_socket='/tmp/mysql.sock', user='root', password='')
except mysql.connector.errors.InterfaceError as e:
print(e)
sys.exit(1)

console = MySQLConsole(db)
myconnpy_version = "%s-%s" % (
'.'.join(map(str,mysql.connector.__version__[0:3])),
mysql.connector.__version__[3])

print("Your MySQL connection ID is %d." % (db.get_server_threadid()))
print("Server version: %s" % (db.get_server_info()))
print("MySQL Connector/Python v%s" % (myconnpy_version))
print()

console.interact()


56 changes: 56 additions & 0 deletions python2/examples/config.py
@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-

# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.

# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptions to the terms and
# conditions of the GPLv2 as it is applied to this software, see the
# FOSS License Exception
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

class Config(object):
"""Configure me so examples work
Use me like this:
mysql.connector.Connect(**Config.dbinfo())
"""

HOST = 'localhost'
DATABASE = 'test'
USER = ''
PASSWORD = ''
PORT = 3306

CHARSET = 'utf8'
UNICODE = True
WARNINGS = True

@classmethod
def dbinfo(cls):
return {
'host': cls.HOST,
'port': cls.PORT,
'database': cls.DATABASE,
'user': cls.USER,
'password': cls.PASSWORD,
'charset': cls.CHARSET,
'use_unicode': cls.UNICODE,
'get_warnings': cls.WARNINGS,
}

0 comments on commit d889f08

Please sign in to comment.