Merge pull request #113 from xanderyzwich/master
Refactoring: remove package_name
This commit is contained in:
@@ -105,30 +105,12 @@ def main():
|
|||||||
# This needs to be passed on to the docker container in linux.py
|
# This needs to be passed on to the docker container in linux.py
|
||||||
os.environ['CIBUILDWHEEL'] = '1'
|
os.environ['CIBUILDWHEEL'] = '1'
|
||||||
|
|
||||||
try:
|
if not os.path.exists(os.path.join(project_dir, 'setup.py')):
|
||||||
project_setup_py = os.path.join(project_dir, 'setup.py')
|
print('cibuildwheel: Could not find setup.py at root of project', file=sys.stderr)
|
||||||
name_output = subprocess.check_output([sys.executable, project_setup_py, '--name'],
|
|
||||||
universal_newlines=True)
|
|
||||||
# the last line of output is the name
|
|
||||||
package_name = name_output.strip().splitlines()[-1]
|
|
||||||
except subprocess.CalledProcessError as err:
|
|
||||||
if not os.path.exists(project_setup_py):
|
|
||||||
print('cibuildwheel: Could not find setup.py at root of project', file=sys.stderr)
|
|
||||||
exit(2)
|
|
||||||
else:
|
|
||||||
print(err.output)
|
|
||||||
print('cibuildwheel: Failed to get name of the package. Command was %s' % err.cmd,
|
|
||||||
file=sys.stderr)
|
|
||||||
exit(err.returncode)
|
|
||||||
|
|
||||||
if package_name == '' or package_name == 'UNKNOWN':
|
|
||||||
print('cibuildwheel: Invalid package name "%s". Check your setup.py' % package_name,
|
|
||||||
file=sys.stderr)
|
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|
||||||
build_options = dict(
|
build_options = dict(
|
||||||
project_dir=project_dir,
|
project_dir=project_dir,
|
||||||
package_name=package_name,
|
|
||||||
output_dir=output_dir,
|
output_dir=output_dir,
|
||||||
test_command=test_command,
|
test_command=test_command,
|
||||||
test_requires=test_requires,
|
test_requires=test_requires,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ except ImportError:
|
|||||||
from pipes import quote as shlex_quote
|
from pipes import quote as shlex_quote
|
||||||
|
|
||||||
|
|
||||||
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment, manylinux1_images):
|
def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment, manylinux1_images):
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['docker', '--version'])
|
subprocess.check_call(['docker', '--version'])
|
||||||
except:
|
except:
|
||||||
@@ -102,7 +102,6 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
|
|||||||
chown {uid}:{gid} "/output/$(basename "$delocated_wheel")"
|
chown {uid}:{gid} "/output/$(basename "$delocated_wheel")"
|
||||||
done
|
done
|
||||||
'''.format(
|
'''.format(
|
||||||
package_name=package_name,
|
|
||||||
pybin_paths=' '.join(c.path+'/bin' for c in platform_configs),
|
pybin_paths=' '.join(c.path+'/bin' for c in platform_configs),
|
||||||
test_requires=' '.join(test_requires),
|
test_requires=' '.join(test_requires),
|
||||||
test_command=shlex_quote(
|
test_command=shlex_quote(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ except ImportError:
|
|||||||
from .util import prepare_command, get_build_verbosity_extra_flags
|
from .util import prepare_command, get_build_verbosity_extra_flags
|
||||||
|
|
||||||
|
|
||||||
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment):
|
def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment):
|
||||||
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url'])
|
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url'])
|
||||||
python_configurations = [
|
python_configurations = [
|
||||||
PythonConfiguration(version='2.7', identifier='cp27-macosx_10_6_intel', url='https://www.python.org/ftp/python/2.7.15/python-2.7.15-macosx10.6.pkg'),
|
PythonConfiguration(version='2.7', identifier='cp27-macosx_10_6_intel', url='https://www.python.org/ftp/python/2.7.15/python-2.7.15-macosx10.6.pkg'),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from glob import glob
|
|||||||
from .util import prepare_command, get_build_verbosity_extra_flags
|
from .util import prepare_command, get_build_verbosity_extra_flags
|
||||||
|
|
||||||
|
|
||||||
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment):
|
def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment):
|
||||||
# run_with_env is a cmd file that sets the right environment variables to
|
# run_with_env is a cmd file that sets the right environment variables to
|
||||||
run_with_env = os.path.join(tempfile.gettempdir(), 'appveyor_run_with_env.cmd')
|
run_with_env = os.path.join(tempfile.gettempdir(), 'appveyor_run_with_env.cmd')
|
||||||
if not os.path.exists(run_with_env):
|
if not os.path.exists(run_with_env):
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
if sys.argv[-1] != '--name':
|
# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step
|
||||||
# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step
|
# is the same one as is currently running.
|
||||||
# is the same one as is currently running.
|
version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt'
|
||||||
version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt'
|
with open(version_file) as f:
|
||||||
with open(version_file) as f:
|
stored_version = f.read()
|
||||||
stored_version = f.read()
|
print('stored_version', stored_version)
|
||||||
print('stored_version', stored_version)
|
print('sys.version', sys.version)
|
||||||
print('sys.version', sys.version)
|
assert stored_version == sys.version
|
||||||
assert stored_version == sys.version
|
|
||||||
|
|
||||||
# check that the executable also was written
|
# check that the executable also was written
|
||||||
executable_file = 'c:\\pythonexecutable.txt' if sys.platform == 'win32' else '/tmp/pythonexecutable.txt'
|
executable_file = 'c:\\pythonexecutable.txt' if sys.platform == 'win32' else '/tmp/pythonexecutable.txt'
|
||||||
with open(executable_file) as f:
|
with open(executable_file) as f:
|
||||||
stored_executable = f.read()
|
stored_executable = f.read()
|
||||||
print('stored_executable', stored_executable)
|
print('stored_executable', stored_executable)
|
||||||
print('sys.executable', sys.executable)
|
print('sys.executable', sys.executable)
|
||||||
# windows/mac are case insensitive
|
# windows/mac are case insensitive
|
||||||
assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower()
|
assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="spam",
|
name="spam",
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.argv[-1] != '--name':
|
# explode if run on Python 2.7 or Python 3.4 (these should be skipped)
|
||||||
# explode if run on Python 2.7 or Python 3.4 (these should be skipped)
|
if sys.version_info[0:2] == (2, 7):
|
||||||
if sys.version_info[0:2] == (2, 7):
|
raise Exception('Python 2.7 should not be built')
|
||||||
raise Exception('Python 2.7 should not be built')
|
if sys.version_info[0:2] == (3, 4):
|
||||||
if sys.version_info[0:2] == (3, 4):
|
raise Exception('Python 3.4 should be skipped')
|
||||||
raise Exception('Python 3.4 should be skipped')
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="spam",
|
name="spam",
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
if sys.argv[-1] != '--name':
|
# explode if environment isn't correct, as set in CIBW_ENVIRONMENT
|
||||||
# explode if environment isn't correct, as set in CIBW_ENVIRONMENT
|
CIBW_TEST_VAR = os.environ.get('CIBW_TEST_VAR')
|
||||||
CIBW_TEST_VAR = os.environ.get('CIBW_TEST_VAR')
|
CIBW_TEST_VAR_2 = os.environ.get('CIBW_TEST_VAR_2')
|
||||||
CIBW_TEST_VAR_2 = os.environ.get('CIBW_TEST_VAR_2')
|
PATH = os.environ.get('PATH')
|
||||||
PATH = os.environ.get('PATH')
|
|
||||||
|
|
||||||
if CIBW_TEST_VAR != 'a b c':
|
if CIBW_TEST_VAR != 'a b c':
|
||||||
raise Exception('CIBW_TEST_VAR should equal "a b c". It was "%s"' % CIBW_TEST_VAR)
|
raise Exception('CIBW_TEST_VAR should equal "a b c". It was "%s"' % CIBW_TEST_VAR)
|
||||||
if CIBW_TEST_VAR_2 != '1':
|
if CIBW_TEST_VAR_2 != '1':
|
||||||
raise Exception('CIBW_TEST_VAR_2 should equal "1". It was "%s"' % CIBW_TEST_VAR_2)
|
raise Exception('CIBW_TEST_VAR_2 should equal "1". It was "%s"' % CIBW_TEST_VAR_2)
|
||||||
if '/opt/cibw_test_path' not in PATH:
|
if '/opt/cibw_test_path' not in PATH:
|
||||||
raise Exception('PATH should contain "/opt/cibw_test_path". It was "%s"' % PATH)
|
raise Exception('PATH should contain "/opt/cibw_test_path". It was "%s"' % PATH)
|
||||||
if '$PATH' in PATH:
|
if '$PATH' in PATH:
|
||||||
raise Exception('$PATH should be expanded in PATH. It was "%s"' % PATH)
|
raise Exception('$PATH should be expanded in PATH. It was "%s"' % PATH)
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ import os, sys
|
|||||||
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
|
|
||||||
if sys.argv[-1] != '--name':
|
# check that we're running in the correct docker image as specified in the
|
||||||
# check that we're running in the correct docker image as specified in the
|
# environment options CIBW_MANYLINUX1_*_IMAGE
|
||||||
# environment options CIBW_MANYLINUX1_*_IMAGE
|
if 'linux' in sys.platform and not os.path.exists('/dockcross'):
|
||||||
if 'linux' in sys.platform and not os.path.exists('/dockcross'):
|
raise Exception('/dockcross directory not found. Is this test running in the correct docker image?')
|
||||||
raise Exception('/dockcross directory not found. Is this test running in the correct docker image?')
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="spam",
|
name="spam",
|
||||||
|
|||||||
Reference in New Issue
Block a user