mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-26 17:29:23 +00:00
Revert #4901
Partially reverts commit 9c5bffcf93.
The reasoning behind this is that setup.py is intended to strictly consume the Makefile and not be consumed by it. The attempt at using them recursively has caused a number of issues and has rendered Pyosys unusable to some users: See https://github.com/YosysHQ/yosys/issues/5012
Additionally, unlike the previous pyosys installation target, the wheel installation does not respect PREFIX=, only venvs.
For installation inside a venv, the intended method should remain a user manually executing `pip3 install .` instead of relying on the Makefile.
This commit is contained in:
parent
2bc2105d82
commit
c18f1310a5
3 changed files with 11 additions and 26 deletions
30
Makefile
30
Makefile
|
|
@ -27,7 +27,6 @@ ENABLE_ZLIB := 1
|
|||
|
||||
# python wrappers
|
||||
ENABLE_PYOSYS := 0
|
||||
ENABLE_WHEEL := $(ENABLE_PYOSYS)
|
||||
|
||||
# other configuration flags
|
||||
ENABLE_GCOV := 0
|
||||
|
|
@ -350,9 +349,6 @@ LINKFLAGS += $(filter-out -l%,$(shell $(PYTHON_CONFIG) --ldflags))
|
|||
LIBS += $(shell $(PYTHON_CONFIG) --libs)
|
||||
EXE_LIBS += $(filter-out $(LIBS),$(shell $(PYTHON_CONFIG_FOR_EXE) --libs))
|
||||
CXXFLAGS += $(shell $(PYTHON_CONFIG) --includes) -DWITH_PYTHON
|
||||
ifeq ($(ENABLE_WHEEL),1)
|
||||
EXTRA_TARGETS += wheel
|
||||
endif
|
||||
|
||||
# Detect name of boost_python library. Some distros use boost_python-py<version>, other boost_python<version>, some only use the major version number, some a concatenation of major and minor version numbers
|
||||
CHECK_BOOST_PYTHON = (echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(LINKFLAGS) $(LIBS) -l$(1) - > /dev/null 2>&1 && echo "-l$(1)")
|
||||
|
|
@ -971,20 +967,6 @@ unit-test: libyosys.so
|
|||
clean-unit-test:
|
||||
@$(MAKE) -C $(UNITESTPATH) clean
|
||||
|
||||
ifeq ($(ENABLE_PYOSYS),1)
|
||||
wheel: $(TARGETS)
|
||||
$(PYTHON_EXECUTABLE) -m pip wheel .
|
||||
|
||||
install-wheel: wheel
|
||||
$(PYTHON_EXECUTABLE) -m pip install pyosys-$(YOSYS_MAJOR).$(YOSYS_MINOR).$(YOSYS_COMMIT)-*.whl --force-reinstall
|
||||
else
|
||||
wheel:
|
||||
$(error Pyosys is not enabled. Set ENABLE_PYOSYS=1 to enable it.)
|
||||
|
||||
install-wheel:
|
||||
$(error Pyosys is not enabled. Set ENABLE_PYOSYS=1 to enable it.)
|
||||
endif
|
||||
|
||||
install: $(TARGETS) $(EXTRA_TARGETS)
|
||||
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL_SUDO) cp $(filter-out libyosys.so,$(TARGETS)) $(DESTDIR)$(BINDIR)
|
||||
|
|
@ -1004,7 +986,13 @@ ifeq ($(ENABLE_LIBYOSYS),1)
|
|||
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)/
|
||||
$(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so
|
||||
ifeq ($(ENABLE_PYOSYS),1)
|
||||
$(INSTALL_SUDO) @$(MAKE) install-wheel
|
||||
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
|
||||
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
|
||||
$(INSTALL_SUDO) cp -r share $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
|
||||
ifeq ($(ENABLE_ABC),1)
|
||||
$(INSTALL_SUDO) cp yosys-abc $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/yosys-abc
|
||||
endif
|
||||
$(INSTALL_SUDO) cp misc/__init__.py $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ENABLE_PLUGINS),1)
|
||||
|
|
@ -1020,7 +1008,9 @@ uninstall:
|
|||
ifeq ($(ENABLE_LIBYOSYS),1)
|
||||
$(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so
|
||||
ifeq ($(ENABLE_PYOSYS),1)
|
||||
$(INSTALL_SUDO) $(PYTHON_EXECUTABLE) -m pip uninstall -y pyosys
|
||||
$(INSTALL_SUDO) rm -vf $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
|
||||
$(INSTALL_SUDO) rm -vf $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/__init__.py
|
||||
$(INSTALL_SUDO) rmdir $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -62,5 +62,5 @@ EXTRA_OBJS += passes/techmap/filterlib.o
|
|||
|
||||
$(PROGRAM_PREFIX)yosys-filterlib$(EXE): passes/techmap/filterlib.o
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
$(P) $(CXX) -o $(PROGRAM_PREFIX)yosys-filterlib$(EXE) $(LINKFLAGS) $^ $(LIBS)
|
||||
$(P) $(CXX) -o $(PROGRAM_PREFIX)yosys-filterlib$(EXE) $(LINKFLAGS) $^ $(EXE_LIBS) $(LIBS)
|
||||
endif
|
||||
|
|
|
|||
5
setup.py
5
setup.py
|
|
@ -40,8 +40,6 @@ class libyosys_so_ext(Extension):
|
|||
)
|
||||
self.args = [
|
||||
"ENABLE_PYOSYS=1",
|
||||
# Prevent recursive wheel build
|
||||
"ENABLE_WHEEL=0",
|
||||
# Would need to be installed separately by the user
|
||||
"ENABLE_TCL=0",
|
||||
"ENABLE_READLINE=0",
|
||||
|
|
@ -87,9 +85,6 @@ class libyosys_so_ext(Extension):
|
|||
|
||||
shutil.copytree("share", share_target)
|
||||
|
||||
# I don't know how debug info is getting here.
|
||||
|
||||
|
||||
class custom_build_ext(build_ext):
|
||||
def build_extension(self, ext) -> None:
|
||||
if not hasattr(ext, "custom_build"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue