Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
setup, conf, circleci, minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed May 17, 2018
1 parent d528973 commit a274d66
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.4
- image: circleci/python:3.6.5

working_directory: ~/repo

Expand Down
14 changes: 0 additions & 14 deletions _doc/sphinxdoc/source/conf.py
@@ -1,24 +1,10 @@
# -*- coding: utf-8 -*-
import sys
import os
import datetime
import re
import sphinx_rtd_theme


sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
sys.path.insert(
0,
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
"..",
"pyquickhelper",
"src")))

local_template = os.path.join(os.path.abspath(
os.path.dirname(__file__)), "phdoc_templates")

Expand Down
3 changes: 2 additions & 1 deletion build_script.bat
Expand Up @@ -5,7 +5,8 @@ set pythonexe="%1"
goto custom_python:

:default_value_python:
set pythonexe="c:\Python364_x64\python.exe"
set pythonexe="c:\Python365_x64\python.exe"
if not exist %pythonexe% set pythonexe="c:\Python364_x64\python.exe"
if not exist %pythonexe% set pythonexe="c:\Python363_x64\python.exe"
if not exist %pythonexe% set pythonexe="c:\Python36_x64\python.exe"
:custom_python:
Expand Down
47 changes: 4 additions & 43 deletions setup.py
Expand Up @@ -51,34 +51,10 @@ def is_local():
file = os.path.abspath(__file__).replace("\\", "/").lower()
if "/temp/" in file and "pip-" in file:
return False
import_pyquickhelper()
from pyquickhelper.pycode.setup_helper import available_commands_list
return available_commands_list(sys.argv)


def import_pyquickhelper():
try:
import pyquickhelper
except ImportError:
sys.path.append(
os.path.normpath(
os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"pyquickhelper",
"src"))))
try:
import pyquickhelper
except ImportError as e:
message = "Module pyquickhelper is needed to build the documentation ({0}), not found in path {1} - current {2}".format(
sys.executable,
sys.path[-1],
os.getcwd())
raise ImportError(message) from e
return pyquickhelper


def verbose():
print("---------------------------------")
print("package_dir =", package_dir)
Expand All @@ -94,20 +70,18 @@ def verbose():

if is_local() and not ask_help():
def write_version():
pyquickhelper = import_pyquickhelper()
from pyquickhelper.pycode import write_version_for_setup
return write_version_for_setup(__file__)

if sys.version_info[0] != 2:
write_version()
write_version()

versiontxt = os.path.join(os.path.dirname(__file__), "version.txt")
if os.path.exists(versiontxt):
with open(versiontxt, "r") as f:
lines = f.readlines()
subversion = "." + lines[0].strip("\r\n ")
if subversion == ".0":
raise Exception("Subversion is wrong: '{0}'.".format(subversion))
raise Exception("Git version is wrong: '{0}'.".format(subversion))
else:
raise FileNotFoundError(versiontxt)
else:
Expand All @@ -116,36 +90,27 @@ def write_version():

if "upload" in sys.argv and not subversion and not ask_help():
# avoid uploading with a wrong subversion number
try:
import pyquickhelper
pyq = True
except ImportError:
pyq = False
raise Exception(
"subversion is empty, cannot upload, is_local()={0}, pyquickhelper={1}".format(is_local(), pyq))
"Git version is empty, cannot upload, is_local()={0}".format(is_local()))

##############
# common part
##############

if os.path.exists(readme):
if sys.version_info[0] == 2:
from codecs import open
with open(readme, "r", encoding='utf-8-sig') as f:
long_description = f.read()
else:
long_description = ""
if os.path.exists(history):
if sys.version_info[0] == 2:
from codecs import open
with open(history, "r", encoding='utf-8-sig') as f:
long_description += f.read()

if "--verbose" in sys.argv:
verbose()

if is_local():
pyquickhelper = import_pyquickhelper()
import pyquickhelper
logging_function = pyquickhelper.get_fLOG()
logging_function(OutputPrint=True)
must_build, run_build_ext = pyquickhelper.get_insetup_functions()
Expand Down Expand Up @@ -179,17 +144,13 @@ def write_version():
r = False

if ask_help():
pyquickhelper = import_pyquickhelper()
from pyquickhelper.pycode import process_standard_options_for_setup_help
process_standard_options_for_setup_help(sys.argv)

if not r:
if len(sys.argv) in (1, 2) and sys.argv[-1] in ("--help-commands",):
pyquickhelper = import_pyquickhelper()
from pyquickhelper.pycode import process_standard_options_for_setup_help
process_standard_options_for_setup_help(sys.argv)
else:
pyquickhelper = import_pyquickhelper()
from pyquickhelper.pycode import clean_readme
long_description = clean_readme(long_description)
root = os.path.abspath(os.path.dirname(__file__))
Expand Down

0 comments on commit a274d66

Please sign in to comment.