Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codechange: Rewrite setup.py #51

Merged
merged 1 commit into from Oct 20, 2019
Merged

Conversation

@LordAro
Copy link
Member

@LordAro LordAro commented Oct 19, 2019

Various changes, mostly related to packaging. Now always uses cx_freeze to build executables on Windows, and standard packaging otherwise

Call with setup.py bdist to build the package

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Oct 20, 2019

May not be for this PR to change but, 'Development Status :: 2 - Pre-Alpha' really?

@andythenorth
Copy link
Contributor

@andythenorth andythenorth commented Oct 20, 2019

May not be for this PR to change but, 'Development Status :: 2 - Pre-Alpha' really?

AFAIK, this is because nml has long been < 1.0

The rationale is that it hasn't been completed to the extent of the original goals, notably:

The tool has been shipping largely unmodified for about 5 years, so the version number scheme might not match the facts on the ground . Or it might all be fine? Dunno :)

@glx22
Copy link
Contributor

@glx22 glx22 commented Oct 20, 2019

Support for 3.8 can be indicated I think

@andythenorth
Copy link
Contributor

@andythenorth andythenorth commented Oct 20, 2019

glx: I tested, it works

Works for me on mac also.

@vineet131
Copy link

@vineet131 vineet131 commented Nov 6, 2019

Just tried installing this on my Windows 10 with Python 3.8, with pip install nml it successfully installed nml-0.4.5 but before that, I did a git clone of the repo and tried to run python setup.py install and it showed ModuleNotFoundError: No module named 'cx_Freeze'. Is cx_Freeze a pip package? I tried pip install cx_Freeze and it downloaded something, but that failed during installation.

@LordAro LordAro deleted the setup-rewrite branch Nov 6, 2019
@LordAro
Copy link
Member Author

@LordAro LordAro commented Nov 6, 2019

pip install nml will work with Python3.8, but nml itself will not work. Someone should make a new release of NML and add it to pip soon.

cx_Freeze is indeed a pip package. Previously it was optional, now it is required (to make a standalone nml.exe). I suspect the installation of cx_Freeze but just in case, what was the error message when you tried to install it?

It does occur to me that if you do have a functioning Python install on Windows, you might not want to generate a standalone exe in the same way. Needs some thought.

@planetmaker
Copy link
Contributor

@planetmaker planetmaker commented Nov 6, 2019

cx_freeze really only is needed for generating a binary - not needed when you have actual python. As such it should not be a requirement, but a maintainer thing.

Or is it difficult on windoze to run a script, provided you have python?

@vineet131
Copy link

@vineet131 vineet131 commented Nov 7, 2019

I found the reason why my cx_Freeze wouldn't install with pip. It's not yet compatible with Python 3.8 it seems. I just tried installing it on Python 3.7.5 and it worked without any issues. So I built cx_Freeze on Python 3.8 from [https://github.com/anthony-tuininga/cx_Freeze](the repo) and it worked well.

However, nml install still fails at python setup.py install. Subsequently, I get this error (just pasting a part of it), which is funny because I have most of the modules mentioned already installed:

Missing modules: ? Image imported from nml.actions.real_sprite, nml.main, nml.spriteencoder, nml.version_info ? PyQt4.QtCore imported from PIL.ImageQt ? PyQt4.QtGui imported from PIL.ImageQt ? PyQt5.QtCore imported from PIL.ImageQt ? PyQt5.QtGui imported from PIL.ImageQt ? PySide.QtCore imported from PIL.ImageQt ? PySide.QtGui imported from PIL.ImageQt ? PySide2.QtCore imported from PIL.ImageQt ? PySide2.QtGui imported from PIL.ImageQt ? StringIO imported from numpy.core.tests.test_print, numpy.distutils.tests.test_exec_command, numpy.lib.format, numpy.lib.tests.test_regression, numpy.lib.tests.test_utils, numpy.lib.utils, numpy.testing._private.utils, pkg_resources._vendor.six ? Tkinter imported from PIL.ImageTk, PIL._tkinter_finder ? UserDict imported from PIL.PdfParser ? __builtin__ imported from PIL.Image, PIL.ImageMath, PIL.WalImageFile, numpy, numpy.core.numeric, numpy.core.numerictypes, numpy.core.tests.test_multiarray, numpy.distutils.misc_util, numpy.lib._iotools, numpy.lib.function_base, numpy.lib.tests.test_format, numpy.ma.core, pkg_resources._vendor.pyparsing ? __main__ imported from bdb, pdb, pkg_resources ? __version__ imported from numpy.f2py.setup ? _curses imported from curses, curses.has_key ? _dummy_threading imported from dummy_threading ? _frozen_importlib imported from importlib, importlib.abc, zipimport ? _frozen_importlib_external imported from importlib, importlib._bootstrap, importlib.abc, zipimport ? _manylinux imported from setuptools.pep425tags ? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory ? _posixsubprocess imported from multiprocessing.util, subprocess ? _scproxy imported from urllib.request ? _uuid imported from uuid ? _winreg imported from numpy.distutils.cpuinfo, pkg_resources._vendor.appdirs, platform ? backports.ssl_match_hostname imported from setuptools.ssl_support ? cffi imported from PIL.Image, PIL.ImageTk, PIL.PyAccess, numpy.random.tests.test_direct ? code_generators.genapi imported from numpy.core.cversions ? code_generators.numpy_api imported from numpy.core.cversions ? collections.Callable imported from PIL.Image ? collections.Iterable imported from pkg_resources._vendor.pyparsing ? collections.Mapping imported from numpy.lib.npyio ? collections.MutableMapping imported from PIL.Image, PIL.TiffImagePlugin, pkg_resources._vendor.pyparsing ? com.sun imported from pkg_resources._vendor.appdirs ? com.sun.jna imported from pkg_resources._vendor.appdirs ? com.sun.jna.platform imported from pkg_resources._vendor.appdirs ? commands imported from numpy.distutils.cpuinfo ? concurrent.futures.ThreadPoolExecutor imported from distutils.command.build_ext ? copy_reg imported from numpy.core ? cpickle imported from numpy.compat.py3k ? dummy_thread imported from numpy.core.arrayprint ? future_builtins imported from numpy.lib.npyio, numpy.lib.recfunctions ? genapi imported from numpy.core.generate_numpy_api ? grp imported from distutils.archive_util, pathlib, shutil, tarfile ? java.lang imported from platform ? md5 imported from numpy.core.tests.test_regression, numpy.f2py.tests.util ? multiprocessing.AuthenticationError imported from multiprocessing.connection ? multiprocessing.BufferTooShort imported from multiprocessing.connection ? multiprocessing.TimeoutError imported from multiprocessing.pool ? multiprocessing.get_context imported from multiprocessing.managers, multiprocessing.pool, multiprocessing.sharedctypes ? multiprocessing.get_start_method imported from multiprocessing.spawn ? multiprocessing.set_start_method imported from multiprocessing.spawn ? netbios imported from uuid ? nml_lz77 imported from nml.lz77 ? nose imported from numpy.testing._private.decorators, numpy.testing._private.noseclasses, numpy.testing._private.utils, numpy.testing.tests.test_decorators, numpy.testing.tests.test_doctesting ? nose.plugins imported from numpy.testing._private.noseclasses, numpy.testing._private.nosetester ? nose.plugins.base imported from numpy.testing._private.noseclasses ? nose.plugins.builtin imported from numpy.testing._private.nosetester ? nose.plugins.errorclass imported from numpy.testing._private.noseclasses ? nose.util imported from numpy.testing._private.noseclasses ? numarray imported from numpy.distutils.system_info ? numpy._build_utils.apple_accelerate imported from numpy.core.setup ? numpy.core.equal imported from numpy.lib.user_array ? numpy.core.float32 imported from numpy.testing._private.utils ? numpy.core.geterrobj imported from numpy.linalg.linalg ? numpy.core.greater_equal imported from numpy.lib.user_array ? numpy.core.integer imported from numpy.fft.helper ? numpy.core.intp imported from numpy.linalg.linalg, numpy.testing._private.utils ? numpy.core.less_equal imported from numpy.lib.user_array ? numpy.core.object_ imported from numpy.linalg.linalg ? numpy.core.signbit imported from numpy.testing._private.utils ? numpy.core.subtract imported from numpy.lib.user_array ? numpy.random.randint imported from numpy.core.tests.test_numeric, numpy.lib.tests.test_arrayterator, numpy.lib.tests.test_shape_base ? numpy.random.random imported from numpy.fft.tests.test_pocketfft ? numpy_api imported from numpy.core.generate_numpy_api ? numpy_distutils imported from numpy.f2py.diagnose ? numpy_distutils.command.build_flib imported from numpy.f2py.diagnose ? numpy_distutils.command.cpuinfo imported from numpy.f2py.diagnose ? numpy_distutils.cpuinfo imported from numpy.f2py.diagnose ? numpy_distutils.fcompiler imported from numpy.f2py.diagnose ? olefile imported from PIL.FpxImagePlugin, PIL.MicImagePlugin ? ordereddict imported from pkg_resources._vendor.pyparsing ? org.python.core imported from copy, pickle ? org.python.modules.posix.PosixModule imported from setuptools.sandbox ? os.path imported from distutils.file_util, numpy.compat.tests.test_compat, numpy.core.cversions, numpy.core.memmap, numpy.core.setup, numpy.distutils.fcompiler.pg, numpy.distutils.tests.test_misc_util, numpy.random.setup, numpy.random.tests.test_direct, numpy.tests.test_scripts, os, pkg_resources, pkgutil, py_compile, sysconfig, tracemalloc, unittest, unittest.util ? pathlib2 imported from PIL.Image, numpy.core.tests.test_multiarray ? pickle5 imported from numpy.compat.py3k ? pkg_resources.extern.appdirs imported from pkg_resources ? pkg_resources.extern.packaging imported from pkg_resources ? pkg_resources.extern.pyparsing imported from pkg_resources._vendor.packaging.markers, pkg_resources._vendor.packaging.requirements ? pkg_resources.extern.six imported from pkg_resources, pkg_resources.py31compat ? pkg_resources.extern.six.moves imported from pkg_resources ? pkg_resources.extern.six.moves.urllib imported from pkg_resources._vendor.packaging.requirements ? ply imported from nml.version_info ? ply.lex imported from nml.tokens ? ply.yacc imported from nml.parser ? posix imported from os, shutil ? pwd imported from distutils.archive_util, distutils.util, getpass, http.server, netrc, pathlib, posixpath, shutil, tarfile, webbrowser ? pytest imported from numpy._pytesttester, numpy.conftest, numpy.core.tests._locales, numpy.core.tests.test_api, numpy.core.tests.test_arrayprint, numpy.core.tests.test_datetime, numpy.core.tests.test_deprecations, numpy.core.tests.test_dtype, numpy.core.tests.test_errstate, numpy.core.tests.test_extint128, numpy.core.tests.test_half, numpy.core.tests.test_indexing, numpy.core.tests.test_longdouble, numpy.core.tests.test_mem_overlap, numpy.core.tests.test_memmap, numpy.core.tests.test_multiarray, numpy.core.tests.test_nditer, numpy.core.tests.test_numeric, numpy.core.tests.test_numerictypes, numpy.core.tests.test_overrides, numpy.core.tests.test_print, numpy.core.tests.test_records, numpy.core.tests.test_regression, numpy.core.tests.test_scalar_ctors, numpy.core.tests.test_scalar_methods, numpy.core.tests.test_scalarbuffer, numpy.core.tests.test_scalarmath, numpy.core.tests.test_scalarprint, numpy.core.tests.test_shape_base, numpy.core.tests.test_ufunc, numpy.core.tests.test_umath, numpy.core.tests.test_umath_accuracy, numpy.core.tests.test_umath_complex, numpy.distutils.tests.test_fcompiler, numpy.distutils.tests.test_shell_utils, numpy.distutils.tests.test_system_info, numpy.f2py.tests.test_array_from_pyobj, numpy.f2py.tests.test_assumed_shape, numpy.f2py.tests.test_block_docstring, numpy.f2py.tests.test_callback, numpy.f2py.tests.test_common, numpy.f2py.tests.test_compile_function, numpy.f2py.tests.test_kind, numpy.f2py.tests.test_mixed, numpy.f2py.tests.test_parameter, numpy.f2py.tests.test_quoted_character, numpy.f2py.tests.test_regression, numpy.f2py.tests.test_return_character, numpy.f2py.tests.test_return_complex, numpy.f2py.tests.test_return_integer, numpy.f2py.tests.test_return_logical, numpy.f2py.tests.test_return_real, numpy.f2py.tests.test_semicolon_split, numpy.f2py.tests.test_size, numpy.f2py.tests.test_string, numpy.f2py.tests.util, numpy.fft.tests.test_pocketfft, numpy.lib.tests.test__datasource, numpy.lib.tests.test_arraypad, numpy.lib.tests.test_arraysetops, numpy.lib.tests.test_format, numpy.lib.tests.test_function_base, numpy.lib.tests.test_index_tricks, numpy.lib.tests.test_io, numpy.lib.tests.test_nanfunctions, numpy.lib.tests.test_packbits, numpy.lib.tests.test_recfunctions, numpy.lib.tests.test_shape_base, numpy.lib.tests.test_utils, numpy.linalg.tests.test_build, numpy.linalg.tests.test_linalg, numpy.ma.tests.test_core, numpy.matrixlib.tests.test_interaction, numpy.polynomial.tests.test_classes, numpy.random.tests.test_direct, numpy.random.tests.test_generator_mt19937, numpy.random.tests.test_generator_mt19937_regressions, numpy.random.tests.test_randomstate, numpy.random.tests.test_randomstate_regression, numpy.random.tests.test_smoke, numpy.testing.tests.test_decorators, numpy.testing.tests.test_utils, numpy.tests.test_ctypeslib, numpy.tests.test_matlib, numpy.tests.test_public_api, numpy.tests.test_scripts, numpy.tests.test_warnings ? pytz imported from numpy.core.tests.test_datetime, numpy.core.tests.test_deprecations ? resource imported from numpy.linalg.tests.test_linalg ? scipy imported from numpy.testing._private.nosetester ? setup_common imported from numpy.core.setup ? setuptools.extern.packaging imported from setuptools.command.egg_info, setuptools.dist ? setuptools.extern.packaging.utils imported from setuptools.wheel ? setuptools.extern.packaging.version imported from setuptools.config ? setuptools.extern.six imported from setuptools, setuptools.command.bdist_egg, setuptools.command.develop, setuptools.command.easy_install, setuptools.command.egg_info, setuptools.command.sdist, setuptools.config, setuptools.dist, setuptools.monkey, setuptools.package_index, setuptools.pep425tags, setuptools.py27compat, setuptools.py33compat, setuptools.sandbox, setuptools.unicode_utils, setuptools.wheel ? setuptools.extern.six.moves imported from setuptools, setuptools.command.easy_install, setuptools.command.egg_info, setuptools.command.py36compat, setuptools.command.setopt, setuptools.dist, setuptools.extension, setuptools.namespaces, setuptools.package_index, setuptools.py33compat, setuptools.sandbox, setuptools.ssl_support ? setuptools.extern.six.moves.configparser imported from setuptools.dist ? termios imported from getpass, tty ? thread imported from numpy.core.arrayprint ? urllib2 imported from numpy.lib._datasource, numpy.lib.tests.test__datasource ? urlparse imported from numpy.lib._datasource, numpy.lib.tests.test__datasource ? vms_lib imported from platform ? win32api imported from distutils.msvccompiler, pkg_resources._vendor.appdirs ? win32com.shell imported from pkg_resources._vendor.appdirs ? win32con imported from distutils.msvccompiler ? win32pdh imported from numpy.testing._private.utils ? win32wnet imported from uuid ? wincertstore imported from setuptools.ssl_support This is not necessarily a problem - the modules may not be needed on this platform.

@andythenorth
Copy link
Contributor

@andythenorth andythenorth commented Nov 7, 2019

There is also some background info on the related issue for this PR: #42.

Particularly respecting 'do we even need cx_Freeze', milek reported in irc a successful nml install in Python on Windows, without binary.
http://webster.openttdcoop.org/?channel=openttd&date=1571443200#1571523920

I'm not sure if our target Windows audience will be able to do that though. Without a Windows binary I'd be concerned about reduction in newgrf authoring.

Respecting python 3.8 I don't have it installed, so haven't tested, but I could get it. One more python can't hurt, I have 11 versions already 👻

@planetmaker
Copy link
Contributor

@planetmaker planetmaker commented Nov 7, 2019

I totally agree, we should by all means possible ship a ready-built binary.

I think this issue is about whether the tools required to build it should be a requirement from setup.py (which only is executed when you have python, thus don't need a binary)

@andythenorth
Copy link
Contributor

@andythenorth andythenorth commented Nov 7, 2019

Applicable competing rules of thumb

  • ideally entire projects should be easy to build
  • ideally projects shouldn't impose complexity or fragility on general users to support (valid) niche cases like maintainers

@glx22
Copy link
Contributor

@glx22 glx22 commented Nov 7, 2019

pyinstaller seems to work quite well to provide a self containing exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants