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

Switch setup.py to use setuptools #68

Closed
WildCard65 opened this issue Jul 15, 2020 · 48 comments · Fixed by #69
Closed

Switch setup.py to use setuptools #68

WildCard65 opened this issue Jul 15, 2020 · 48 comments · Fixed by #69

Comments

@WildCard65
Copy link
Contributor

WildCard65 commented Jul 15, 2020

Discussion is currently going on at bpo-41282 to depreciate and remove distutils, AMBuild uses distutils for installation, but it doesn't support egg info generation which is required to uninstall AMBuild with pip.

Note: pip can install source distributions from an AMBuild repo clone/zip extract.
Note 2: setuptools mimics distutils to the point where minimal work will be required for AMBuild to switch.

@dvander
Copy link
Member

dvander commented Jul 15, 2020

Thanks for bringing this up. I've been fighting distutils lately, so I might give this switch a try.

@WildCard65
Copy link
Contributor Author

@dvander One suggestion I want to make for the switch (if you go for it) is to drop the 'scripts' folder.

Setuptools includes a handy 'entry_points' keyword argument in the 'setup' function, and a special 'console_scripts' entry. for AMBuild2, I recommend an entry like: 'ambuild = ambuild2.run:cli_run'. Setuptools then generates a platform appropriate script (executable on Windows) that'll invoke the entry point.

@WildCard65
Copy link
Contributor Author

Infact @dvander , while quickly checking the setup.py script and setuptools' documentation, theoretically you can just straight up swap the target import from distutils to setuptools and be done with it.

@dvander
Copy link
Member

dvander commented Jul 15, 2020

That's good to know. AMBuild is due for some maintenance (I have a large TODO to fix how to detects MSVC) so I can give this a try soon.

@WildCard65
Copy link
Contributor Author

@dvander If you would allow me, I can quickly get a Pull Request up to pull the trigger on the switch.

@dvander
Copy link
Member

dvander commented Jul 30, 2020

Traceback (most recent call last):
  File "/usr/local/bin/ambuild", line 11, in <module>
    load_entry_point('AMBuild==2.0', 'console_scripts', 'ambuild')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2851, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'ambuild') not found

Something doesn't work here on Ubuntu 20 for me. The generated "ambuild" script fails with the above error. When I restore the old ambuild script, it works fine.

@WildCard65
Copy link
Contributor Author

That error reads that it was unable to load the entry point.

The entry point is 'cli_run' in run.py, does it exist?

@WildCard65
Copy link
Contributor Author

I was unable to replicate your issue with Ubuntu 20.04 (via Windows Subsystem for Linux):

wildcard65@WildCard65-Laptop:~/ambuild$ python3 ./setup.py install --user
running install
running bdist_egg
running egg_info
writing AMBuild.egg-info/PKG-INFO
writing dependency_links to AMBuild.egg-info/dependency_links.txt
writing entry points to AMBuild.egg-info/entry_points.txt
writing top-level names to AMBuild.egg-info/top_level.txt
reading manifest file 'AMBuild.egg-info/SOURCES.txt'
writing manifest file 'AMBuild.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/database.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/graph.py -> build/bdist.linux-x86_64/egg/ambuild2
creating build/bdist.linux-x86_64/egg/ambuild2/frontend
copying build/lib/ambuild2/frontend/paths.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/amb2
copying build/lib/ambuild2/frontend/v2_0/amb2/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/amb2
copying build/lib/ambuild2/frontend/v2_0/amb2/gen.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/amb2
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/cxx.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/xmlbuilder.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/graph.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/nodes.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/export_vcxproj.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
copying build/lib/ambuild2/frontend/v2_0/vs/gen.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp
copying build/lib/ambuild2/frontend/v2_0/cpp/compilers.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp
copying build/lib/ambuild2/frontend/v2_0/cpp/vendors.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp
copying build/lib/ambuild2/frontend/v2_0/cpp/detect.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp
copying build/lib/ambuild2/frontend/v2_0/cpp/builders.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp
copying build/lib/ambuild2/frontend/v2_0/cpp/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp
copying build/lib/ambuild2/frontend/v2_0/prep.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/base
copying build/lib/ambuild2/frontend/v2_0/base/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/base
copying build/lib/ambuild2/frontend/v2_0/base/gen.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/base
copying build/lib/ambuild2/frontend/v2_0/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0
copying build/lib/ambuild2/frontend/version.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/amb2
copying build/lib/ambuild2/frontend/v2_1/amb2/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/amb2
copying build/lib/ambuild2/frontend/v2_1/amb2/gen.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/amb2
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/cxx.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/xmlbuilder.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/graph.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/nodes.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/export_vcxproj.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
copying build/lib/ambuild2/frontend/v2_1/vs/gen.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/sunpro.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/msvc.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/gcc.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/vendor.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/detect.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/builders.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/cpp/compiler.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp
copying build/lib/ambuild2/frontend/v2_1/prep.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base
copying build/lib/ambuild2/frontend/v2_1/base/context.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base
copying build/lib/ambuild2/frontend/v2_1/base/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base
copying build/lib/ambuild2/frontend/v2_1/base/gen.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base
copying build/lib/ambuild2/frontend/v2_1/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1
creating build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/tools
copying build/lib/ambuild2/frontend/v2_1/tools/fxc.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/tools
copying build/lib/ambuild2/frontend/v2_1/tools/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/tools
copying build/lib/ambuild2/frontend/system.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend
copying build/lib/ambuild2/frontend/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/frontend
creating build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/linux.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/impl.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/process.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/bsd.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/posix_proc.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/generic_poll.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/windows.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/winapi.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/ipc/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2/ipc
copying build/lib/ambuild2/util.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/run.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/task.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/builder.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/context.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/nodetypes.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/damage.py -> build/bdist.linux-x86_64/egg/ambuild2
copying build/lib/ambuild2/__init__.py -> build/bdist.linux-x86_64/egg/ambuild2
creating build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/cpp.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/cache.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/job.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/worker.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/runner.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/osutil.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/__init__.py -> build/bdist.linux-x86_64/egg/ambuild
copying build/lib/ambuild/command.py -> build/bdist.linux-x86_64/egg/ambuild
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/database.py to database.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/graph.py to graph.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/paths.py to paths.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/amb2/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/amb2/gen.py to gen.cpython-38.pyc
build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/amb2/gen.py:735: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if folder is -1:
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/cxx.py to cxx.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/xmlbuilder.py to xmlbuilder.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/graph.py to graph.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/nodes.py to nodes.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/export_vcxproj.py to export_vcxproj.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/vs/gen.py to gen.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/compilers.py to compilers.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/vendors.py to vendors.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/detect.py to detect.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/builders.py to builders.cpython-38.pyc
build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/builders.py:269: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target_platform is 'mac':
build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/builders.py:285: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target_platform is 'linux':
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/cpp/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/prep.py to prep.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/base/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/base/gen.py to gen.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_0/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/version.py to version.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/amb2/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/amb2/gen.py to gen.cpython-38.pyc
build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/amb2/gen.py:745: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if folder is -1:
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/cxx.py to cxx.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/xmlbuilder.py to xmlbuilder.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/graph.py to graph.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/nodes.py to nodes.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/export_vcxproj.py to export_vcxproj.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/vs/gen.py to gen.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/sunpro.py to sunpro.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/msvc.py to msvc.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/gcc.py to gcc.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/vendor.py to vendor.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/detect.py to detect.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/builders.py to builders.cpython-38.pyc
build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/builders.py:482: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target.platform is 'mac':
build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/builders.py:498: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target.platform is 'linux':
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/cpp/compiler.py to compiler.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/prep.py to prep.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base/context.py to context.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/base/gen.py to gen.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/tools/fxc.py to fxc.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/v2_1/tools/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/system.py to system.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/frontend/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/linux.py to linux.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/impl.py to impl.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/process.py to process.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/bsd.py to bsd.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/posix_proc.py to posix_proc.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/generic_poll.py to generic_poll.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/windows.py to windows.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/winapi.py to winapi.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/ipc/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/util.py to util.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/run.py to run.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/task.py to task.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/builder.py to builder.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/context.py to context.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/nodetypes.py to nodetypes.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/damage.py to damage.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild2/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/cpp.py to cpp.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/cache.py to cache.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/job.py to job.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/worker.py to worker.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/runner.py to runner.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/osutil.py to osutil.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/ambuild/command.py to command.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-3.8/ambuild_objcopy_wrapper.sh -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/ambuild_objcopy_wrapper.sh to 755
copying AMBuild.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying AMBuild.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying AMBuild.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying AMBuild.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying AMBuild.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying AMBuild.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/AMBuild-2.0-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing AMBuild-2.0-py3.8.egg
creating /home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg
Extracting AMBuild-2.0-py3.8.egg to /home/wildcard65/.local/lib/python3.8/site-packages
/home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg/ambuild2/frontend/v2_0/amb2/gen.py:735: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if folder is -1:
/home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg/ambuild2/frontend/v2_0/cpp/builders.py:269: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target_platform is 'mac':
/home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg/ambuild2/frontend/v2_0/cpp/builders.py:285: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target_platform is 'linux':
/home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg/ambuild2/frontend/v2_1/amb2/gen.py:745: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if folder is -1:
/home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg/ambuild2/frontend/v2_1/cpp/builders.py:482: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target.platform is 'mac':
/home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg/ambuild2/frontend/v2_1/cpp/builders.py:498: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif cx.target.platform is 'linux':
Adding AMBuild 2.0 to easy-install.pth file
Installing ambuild_objcopy_wrapper.sh script to /home/wildcard65/.local/bin
Installing ambuild script to /home/wildcard65/.local/bin

Installed /home/wildcard65/.local/lib/python3.8/site-packages/AMBuild-2.0-py3.8.egg
Processing dependencies for AMBuild==2.0
Finished processing dependencies for AMBuild==2.0
wildcard65@WildCard65-Laptop:~/ambuild$ cd ../
wildcard65@WildCard65-Laptop:~$ command -v ambuild
/home/wildcard65/.local/bin/ambuild
wildcard65@WildCard65-Laptop:~$ ambuild
Error: folder was not configured for AMBuild.
wildcard65@WildCard65-Laptop:~$

I was only able to replicate after running the following command:

pip3 uninstall ambuild

@WildCard65
Copy link
Contributor Author

WildCard65 commented Jul 30, 2020

@dvander Managed to actually replicate the issue you have:

wildcard65@WildCard65-Laptop:~/ambuild$ ambuild
Traceback (most recent call last):
  File "/home/wildcard65/.local/bin/ambuild", line 11, in <module>
    load_entry_point('AMBuild==2.0', 'console_scripts', 'ambuild')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2853, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'ambuild') not found

The cause: Your prior installation of AMBuild
Solution: Clean out everything AMBuild related (egg stuff as well!) and remove AMBuild's entry from 'easy_install.pth' in your site-packages directory.

@WildCard65
Copy link
Contributor Author

Clarification:
When 'setuptools'/'pip' goes to replace an existing installation, it first has to uninstall the existing installation.

This will ALWAYS fail for disutils installed packages.

@dvander
Copy link
Member

dvander commented Jul 30, 2020

How do we fix this?

@dvander dvander reopened this Jul 30, 2020
@WildCard65
Copy link
Contributor Author

Unfortunately, it's a limitation of pip and setuptools, they explicitly complain that disutils installed packages can't be reliabily uninstalled.

Mitigation wise is warning people about having preinstalled previous versions.

@dvander
Copy link
Member

dvander commented Jul 30, 2020

It seems like the setuptools script should error if there is a distutils version installed. I wound up with a broken installation which is not very good.

@WildCard65
Copy link
Contributor Author

WildCard65 commented Jul 30, 2020 via email

@dvander
Copy link
Member

dvander commented Jul 30, 2020

There's no way to have the new installer check that a version was installed with the previous installer? Why are we using this new installer, then? :)

@WildCard65
Copy link
Contributor Author

WildCard65 commented Jul 30, 2020 via email

@dvander
Copy link
Member

dvander commented Jul 30, 2020

If there is literally no way to have the new installer check and error on a distutils install - I'd like to revert this change. A warning is good in principle, but will get lost in the gratuitous installation spew - it has to be an error.

It seems hard to believe setuptools is missing a basic principle of package management - there's no way to run an arbitrary script as a prerequisite, where we could check if there is a distutils version of the same package?

@WildCard65
Copy link
Contributor Author

WildCard65 commented Jul 30, 2020 via email

@dvander
Copy link
Member

dvander commented Jul 30, 2020

I'd be fine moving to pip, but no matter what we do, we need some breaker to make sure we don't create two conflicting installs. It's just a terrible experience - I lost an hour trying to figure out what was going on, and I'm sure someone less involved than me would give up and conclude AMBuild was broken.

Looking at setup.py, it's just a normal Python script. It seems like we should be able to throw some detection logic in there and prevent it from running.

@dvander
Copy link
Member

dvander commented Jul 30, 2020

I can look tonight to see if there's anything in the distutils API for doing this.

@WildCard65
Copy link
Contributor Author

WildCard65 commented Jul 30, 2020 via email

@WildCard65
Copy link
Contributor Author

@dvander There may not even be API for that other than potentially utilizing pip's code, the easiest solution would be adding an easy to access advisory warning and heavily request people install AMBuild using 'pip'

example pip command: 'pip install <path_to_ambuild_dir>'
This is also preferred for when install source distributions (.zip/.tar.gz files) or wheel files (.whl).

Another thing to note, should distutils become depreciated and removed, only setuptools will provide a copy of it, and even then, they'll most likely redirect ALL utilizations to setuptools itself. Pip already does this when it goes and installs distutils packages.

@WildCard65
Copy link
Contributor Author

@dvander I think I may have found a more reliable "dummy solution":

distutils creates a file with the extension ".egg-info" and plops it alongside the ambuild packages, wheel/egg installs on the otherhand keep this file in a sub-folder instead.

@dvander
Copy link
Member

dvander commented Jul 31, 2020

If in the objdir/sourcedir, that sounds unideal since then a second copy would break.

@WildCard65
Copy link
Contributor Author

I was talking about the site_packages folder.

Anyway, incase you didn't look at the setuptools issue I created, there is plans to depreciate the use of 'setup.py install' and that using that can break Python environments...

@WildCard65
Copy link
Contributor Author

@dvander Is it alright if I file pull requests with all projects that install AMBuild if it's not already installed, these pull requests will swap the checkout-deps scripts to using pip/pip3 instead of straight invoking setup.py install

@dvander
Copy link
Member

dvander commented Jul 31, 2020

Yup, that's fine, we should change the AMBuild documentation as well.

@dvander
Copy link
Member

dvander commented Jul 31, 2020

And, if "setup.py install" shouldn't be used, we should forbid using it.

@WildCard65
Copy link
Contributor Author

Ok, I'll begin setting up PRs for the repos who's checkout-deps scripts install AMBuild.

@WildCard65
Copy link
Contributor Author

WildCard65 commented Jul 31, 2020

@dvander PRs are done, AMTL gave me the worst headache to deal with though...
Edit: Sorry if I may of ended up flooding your inbox.

@WildCard65
Copy link
Contributor Author

Only SourceMod's remains (It also has a SM issue tied to it)

@WildCard65
Copy link
Contributor Author

I think this can now officially be closed. Any further issues regarding this change should go into it's own issue now.

@dvander dvander reopened this Jul 31, 2020
@dvander
Copy link
Member

dvander commented Jul 31, 2020

Remaining: need to block CLI setup.py installs and change documentation. I can do the latter pretty quickly, not sure about the former.

@WildCard65
Copy link
Contributor Author

The former has to be done on the pip/setuptools end, the only other thing we could do is switch to PEP 517 format, but that is experimental at best.

@WildCard65
Copy link
Contributor Author

@dvander I also made some documentation changes for AMBuild, I also fixed the 'pip install' command on it as what you wrote fails (as PIP would look on PyPi instead of locally)

@dvander
Copy link
Member

dvander commented Aug 1, 2020

This remains open (and reverts possible) until we've addressed all the installation issues. I'll take a look tonight.

@WildCard65
Copy link
Contributor Author

WildCard65 commented Aug 1, 2020

On the Pull Request I opened for Steamworks, you mentioned that CI should be using tagged releases of AMBuild and not straight git cloning, I propose we switched to tagged releases and provide universal wheels that can be downloaded and installed.

This will accomplish restricting the usage of setup.py as it's not being distributed while the "source" zip GitHub automatically provides can also be downloaded and installed by PIP (testing required) which will include setup.py

Building wheels requires setuptools as distutils doesn't include 'bdist_wheel' command

Edit: Yes, install source zips is supported by PIP.

PS C:\Users\lollo\Downloads> pip install ./ambuild-master.zip
Defaulting to user installation because normal site-packages is not writeable
Processing c:\users\lollo\downloads\ambuild-master.zip
Building wheels for collected packages: AMBuild
  Building wheel for AMBuild (setup.py) ... done
  Created wheel for AMBuild: filename=AMBuild-2.0-py3-none-any.whl size=144128 sha256=8f88d893a5819dacf57ff7e9e3653db6c0288c82fd9ce7fc8ee7069035c20208
  Stored in directory: c:\users\lollo\appdata\local\pip\cache\wheels\77\21\2c\2f4b889ddfdf5a9608a3baf9f194b2fd43a2b7763f2ff4219f
Successfully built AMBuild
Installing collected packages: AMBuild
  WARNING: The script ambuild.exe is installed in 'C:\Users\lollo\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed AMBuild-2.0

@dvander
Copy link
Member

dvander commented Aug 1, 2020

I don't particularly care how CIs install ambuild, as long as it works. They always have the option of pinning to a specific rev. I just created the "2.1-distutils" tag so SteamWorks can checkout to that version as a quick fix if desired.

@WildCard65
Copy link
Contributor Author

WildCard65 commented Aug 1, 2020

Actually, you needed to checkout the commit first before creating the tag.
I managed to create one that actually is pinned to the last commit you're referencing (If you want to look):
https://github.com/WildCard65/ambuild/releases/tag/2.1_distutils

Here's the command:
git checkout 0db7a7d8d0869c1d70159d9d0fa168ae48e615be

@dvander
Copy link
Member

dvander commented Aug 1, 2020

#75

Is my attempt to fix this. I've tested it locally, and I get:

You have a previous installation of AMBuild. AMBuild must
now be installed by pip (see README.md). To prevent
conflicts, please remove the old distutils install. You can
do this by inspecting the following locations and removing
any ambuild folders:

	/usr/local/lib/python3.8/dist-packages

Aborting installation.

It's by no means perfect but unless there's anything better, I'm happy to settle it at that.

@dvander
Copy link
Member

dvander commented Aug 1, 2020

Thanks for updating the doc. Aside from third-party CI (which can check out an older rev), I think this is all in a much better state now. pip is much better than distutils.

@dvander dvander closed this as completed Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants