Skip to content

Commit

Permalink
use pyproject.toml instead of setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
roeger committed Dec 17, 2024
1 parent c60b6ab commit a6a61bd
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 108 deletions.
52 changes: 52 additions & 0 deletions _custom_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from setuptools import Extension
from setuptools.command.build_py import build_py as _build_py
from setuptools.command.bdist_wheel import bdist_wheel as _bdist_wheel
import os
import shutil
import subprocess
import sys

def clone_and_compile_fast_downward():
FAST_DOWNWARD_REPO = 'https://github.com/aibasel/downward.git'
FAST_DOWNWARD_RELEASE = 'release-23.06'
#FAST_DOWNWARD_RELEASE = None
# CHANGESET is ignored if release is not None
FAST_DOWNWARD_CHANGESET = 'bd3c63647a42c9a5f103402615ca991d23a88d55'

curr_dir = os.getcwd()
print("Cloning Fast Downward repository...")
if FAST_DOWNWARD_RELEASE is not None:
subprocess.run(['git', 'clone', '-b', FAST_DOWNWARD_RELEASE, FAST_DOWNWARD_REPO])
else:
subprocess.run(['git', 'clone', FAST_DOWNWARD_REPO])

shutil.move('downward', 'up_fast_downward/downward')
os.chdir('up_fast_downward/downward')
if FAST_DOWNWARD_RELEASE is None:
subprocess.run(['git', 'checkout', FAST_DOWNWARD_CHANGESET])
print("Building Fast Downward (this can take some time)...")
build = subprocess.run(['python', 'build.py', 'release'],
stdout = subprocess.PIPE, stderr = subprocess.PIPE,
universal_newlines = True)
os.chdir(curr_dir)

class install_fast_downward(_build_py):
"""Custom install command."""

def run(self, *args, **kwargs):
clone_and_compile_fast_downward()
super().run(*args, **kwargs)


class bdist_wheel(_bdist_wheel):

def finalize_options(self):
_bdist_wheel.finalize_options(self)
# Mark us as not a pure python package
self.root_is_pure = False

def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
# We don't link with python ABI, but require python3
python, abi = 'py3', 'none'
return python, abi, plat
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[project]
name = "up_fast_downward"
version = "0.4.2"
description = "Unified Planning Integration of the Fast Downward planning system"
readme = {text = "This package makes the [Fast Downward](https://www.fast-downward.org/) planning system available in the [unified_planning library](https://github.com/aiplan4eu/unified-planning).", content-type = "text/markdown"}
requires-python = ">=3.8"
license = {text = "GPL-3.0-only"}
authors = [
{name = "UNIBAS Team"},
]
maintainers = [
{name = "Gabriele Röger", email = "[email protected]"},
]
dependencies = ["setuptools>=75.3.0"]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]

[project.urls]
Homepage = "https://github.com/aiplan4eu/up-fast-downward/"

[tool.setuptools]
py-modules = ["_custom_build"]

[tool.setuptools.cmdclass]
build_py = "_custom_build.install_fast_downward"
bdist_wheel = "_custom_build.bdist_wheel"

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.package-data]
"" = ['fast_downward.py',
'fast_downward_grounder.py',
'utils.py',
'downward/fast-downward.py',
'downward/README.md', 'downward/LICENSE.md',
'downward/builds/release/bin/*',
'downward/builds/release/bin/translate/*',
'downward/builds/release/bin/translate/pddl/*',
'downward/builds/release/bin/translate/pddl_parser/*',
'downward/driver/*', 'downward/driver/portfolios/*']
108 changes: 0 additions & 108 deletions setup.py

This file was deleted.

0 comments on commit a6a61bd

Please sign in to comment.