Skip to content
Permalink
Browse files

migration to 2.7

  • Loading branch information...
sdpython committed Apr 17, 2015
1 parent cb5ad04 commit ac714de8f40b4649741d8cb84bb436e2ac1d2bd1
Showing with 86 additions and 11 deletions.
  1. +1 −0 .gitignore
  2. +5 −2 _unittests/ut_example/test_example.py
  3. +48 −0 build_setup_help_on_windows_27.bat
  4. +32 −9 setup.py
@@ -235,3 +235,4 @@ _doc/sphinxdoc/source/blog/rss.xml
_doc/sphinxdoc/source/phdoc_templates/*.html
_doc/sphinxdoc/source/blog/feed-icon*.png
_doc/notebooks/.ipynb_checkpoints/*
dist_module27/*
@@ -14,7 +14,6 @@

try:
import src
import pyquickhelper
except ImportError:
path = os.path.normpath(
os.path.abspath(
@@ -24,6 +23,11 @@
"..")))
if path not in sys.path:
sys.path.append(path)
import src

try:
import pyquickhelper
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
@@ -35,7 +39,6 @@
"src")))
if path not in sys.path:
sys.path.append(path)
import src
import pyquickhelper


@@ -0,0 +1,48 @@
echo off
IF EXIST dist del /Q dist\*.*

set PYTHONPATH=

if "%1"=="" goto default_value:
set pythonexe27="%1"
goto py34:

:default_value:
set pythonexe27=c:\Anaconda2\python

:py34:
if "%2"=="" goto default_value34:
set pythonexe34="%2"
goto utpy34:

:default_value34:
set pythonexe34=c:\Python34_x64\python


:utpy34:
%pythonexe34% setup.py copy27
if %errorlevel% neq 0 exit /b %errorlevel%
cd dist_module27\_unittests

for /d %%d in (ut_*) do %pythonexe27%\..\Scripts\nosetests.exe -w %%d

if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################
cd ..

rem we add the script with publish the module for python 2.7
echo %pythonexe27% setup.py bdist_wheel upload > publish_on_pipy27.bat

:setup27_x64_msi_wheel:
%pythonexe27% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################
cd ..
if not exist dist: mkdir dist
copy dist_module27\dist\*.whl dist

rem
rem autopep8
rem coverage
rem flake8
rem wheel
@@ -91,9 +91,9 @@

if os.path.exists(readme):
try:
with open(readme, "r", encoding='utf-8') as f:
with open(readme, "r", encoding='utf-8-sig') as f:
long_description = f.read()
long_description = long_description.replace("\ufeff", "")
long_description = long_description
except:
try:
with open(readme, "r") as f:
@@ -116,13 +116,24 @@ def import_pyquickhelper():
try:
import pyquickhelper
except ImportError:
sys.path.append(
os.path.normpath(
os.path.abspath(
os.path.join(
"..",
"pyquickhelper",
"src"))))
if sys.version_info[0] == 2:
sys.path.append(
os.path.normpath(
os.path.abspath(
os.path.join(
"..",
"..",
"pyquickhelper",
"dist_module27",
"src"))))
else:
sys.path.append(
os.path.normpath(
os.path.abspath(
os.path.join(
"..",
"pyquickhelper",
"src"))))
try:
import pyquickhelper
except ImportError as e:
@@ -191,6 +202,18 @@ def import_pyquickhelper():
pyquickhelper = import_pyquickhelper()
pyquickhelper.main_wrapper_tests(run_unit, add_coverage=True)

elif "copy27" in sys.argv:

if sys.version_info[0] < 3:
raise Exception("Python needs to be Python3")

pyquickhelper = import_pyquickhelper()
root = os.path.abspath(os.path.dirname(__file__))
root = os.path.normpath(root)
dest = os.path.join(root, "dist_module27")
pyquickhelper.py3to2_convert_tree(root, dest, unittest_modules=["pyquickhelper"],
pattern_copy=".*[.]((ico)|(dll)|(rst)|(ipynb)|(png)|(txt)|(zip)|(gz)|(tohelp))$")

else:

setup(

0 comments on commit ac714de

Please sign in to comment.
You can’t perform that action at this time.