From 08ceb4910a198a46720cbcfc5b2045d274ff3427 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Fri, 19 Nov 2021 09:17:34 +0000 Subject: [PATCH 1/4] Fix docs to say that --no-setup-py is the default Closes gh-469 --- doc/cmdline.rst | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/cmdline.rst b/doc/cmdline.rst index ca3064d0..d0960a75 100644 --- a/doc/cmdline.rst +++ b/doc/cmdline.rst @@ -42,15 +42,18 @@ Build a wheel and an sdist (tarball) from the package. .. option:: --setup-py Generate a ``setup.py`` file in the sdist, so it can be installed by older - versions of pip. This is the default for now, but a future version will - disable this by default. + versions of pip. .. option:: --no-setup-py - Don't generate a setup.py file in the sdist. + Don't generate a setup.py file in the sdist. This is the default. An sdist built without this will only work with tools that support PEP 517, but the wheel will still be usable by any compatible tool. + .. versionchanged:: 3.5 + + Generating ``setup.py`` disabled by default. + .. _publish_cmd: ``flit publish`` @@ -69,15 +72,18 @@ or another repository. .. option:: --setup-py Generate a ``setup.py`` file in the sdist, so it can be installed by older - versions of pip. This is the default for now, but a future version will - disable this by default. + versions of pip. .. option:: --no-setup-py - Don't generate a setup.py file in the sdist. + Don't generate a setup.py file in the sdist. This is the default. An sdist built without this will only work with tools that support PEP 517, but the wheel will still be usable by any compatible tool. + .. versionchanged:: 3.5 + + Generating ``setup.py`` disabled by default. + .. option:: --repository Name of a repository to upload packages to. Should match a section in From 0f4d5297b5083d925810a2a6e0589941d88958dc Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 22 Nov 2021 19:12:21 +0000 Subject: [PATCH 2/4] Add failing tests for installing module with src layout --- tests/test_install.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/test_install.py b/tests/test_install.py index c6d9e26c..77a90076 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -81,6 +81,16 @@ def test_install_package(self): samples_dir / 'package1', 'package1', '0.1', expected_editable=False ) + def test_install_module_in_src(self): + oldcwd = os.getcwd() + os.chdir(samples_dir / 'packageinsrc') + try: + Installer.from_ini_path(pathlib.Path('pyproject.toml')).install_directly() + finally: + os.chdir(oldcwd) + assert_isfile(self.tmpdir / 'site-packages' / 'module1.py') + assert_isdir(self.tmpdir / 'site-packages' / 'module1-0.1.dist-info') + def test_install_ns_package_native(self): Installer.from_ini_path(samples_dir / 'ns1-pkg' / 'pyproject.toml').install_directly() assert_isdir(self.tmpdir / 'site-packages' / 'ns1') @@ -156,6 +166,19 @@ def test_symlink_module_pep621(self): expected_editable=True ) + def test_symlink_module_in_src(self): + oldcwd = os.getcwd() + os.chdir(samples_dir / 'packageinsrc') + try: + Installer.from_ini_path( + pathlib.Path('pyproject.toml'), symlink=True + ).install_directly() + finally: + os.chdir(oldcwd) + assert_islink(self.tmpdir / 'site-packages' / 'module1.py', + to=(samples_dir / 'packageinsrc' / 'src' / 'module1.py')) + assert_isdir(self.tmpdir / 'site-packages' / 'module1-0.1.dist-info') + def test_pth_package(self): Installer.from_ini_path(samples_dir / 'package1' / 'pyproject.toml', pth=True).install() assert_isfile(self.tmpdir / 'site-packages' / 'package1.pth') @@ -166,6 +189,22 @@ def test_pth_package(self): samples_dir / 'package1', 'package1', '0.1', expected_editable=True ) + def test_pth_module_in_src(self): + oldcwd = os.getcwd() + os.chdir(samples_dir / 'packageinsrc') + try: + Installer.from_ini_path( + pathlib.Path('pyproject.toml'), pth=True + ).install_directly() + finally: + os.chdir(oldcwd) + pth_path = self.tmpdir / 'site-packages' / 'module1.pth' + assert_isfile(pth_path) + assert pth_path.read_text('utf-8').strip() == str( + samples_dir / 'packageinsrc' / 'src' + ) + assert_isdir(self.tmpdir / 'site-packages' / 'module1-0.1.dist-info') + def test_dist_name(self): Installer.from_ini_path(samples_dir / 'altdistname' / 'pyproject.toml').install_directly() assert_isdir(self.tmpdir / 'site-packages' / 'package1') From 96090354b3a7099480fd85ab1358e7f2a286673d Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 22 Nov 2021 19:12:46 +0000 Subject: [PATCH 3/4] Fix installing module with src layout --- flit/install.py | 5 +++-- flit_core/flit_core/common.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flit/install.py b/flit/install.py index 02215780..fe095d65 100644 --- a/flit/install.py +++ b/flit/install.py @@ -287,7 +287,8 @@ def install_directly(self): os.makedirs(dirs['purelib'], exist_ok=True) os.makedirs(dirs['scripts'], exist_ok=True) - dst = osp.join(dirs['purelib'], str(self.module.relpath)) + module_rel_path = self.module.path.relative_to(self.module.source_dir) + dst = osp.join(dirs['purelib'], module_rel_path) if osp.lexists(dst): if osp.isdir(dst) and not osp.islink(dst): shutil.rmtree(dst) @@ -316,7 +317,7 @@ def install_directly(self): # added to sys.path) pth_file = pathlib.Path(dirs['purelib'], self.module.name + '.pth') log.info("Adding .pth file %s for %s", pth_file, self.module.source_dir) - pth_file.write_text(str(self.module.source_dir), 'utf-8') + pth_file.write_text(str(self.module.source_dir.resolve()), 'utf-8') self.installed_files.append(pth_file) elif self.module.is_package: log.info("Copying directory %s -> %s", src, dst) diff --git a/flit_core/flit_core/common.py b/flit_core/flit_core/common.py index d29e50b7..f1f378f5 100644 --- a/flit_core/flit_core/common.py +++ b/flit_core/flit_core/common.py @@ -57,7 +57,6 @@ def __init__(self, name, directory=Path()): elif not existing: raise ValueError("No file/folder found for module {}".format(name)) - self.relpath = self.path.relative_to(directory) self.source_dir = directory / self.prefix if '.' in name: From 9280a7144e06e9e3574d76c647c34b04ecf6844a Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Tue, 23 Nov 2021 11:08:36 +0000 Subject: [PATCH 4/4] =?UTF-8?q?Bump=20version:=203.5.0=20=E2=86=92=203.5.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- doc/conf.py | 2 +- flit/__init__.py | 2 +- flit_core/flit_core/__init__.py | 2 +- pyproject.toml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c7a6c9bf..e0448d9b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.5.0 +current_version = 3.5.1 commit = True tag = False diff --git a/doc/conf.py b/doc/conf.py index 8c994c11..77526e12 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -57,7 +57,7 @@ # built documents. # # The short X.Y version. -version = '3.5.0' +version = '3.5.1' # The full version, including alpha/beta/rc tags. release = version #+ '.1' diff --git a/flit/__init__.py b/flit/__init__.py index be3ab050..f0b18165 100644 --- a/flit/__init__.py +++ b/flit/__init__.py @@ -12,7 +12,7 @@ from .config import ConfigError from .log import enable_colourful_output -__version__ = '3.5.0' +__version__ = '3.5.1' log = logging.getLogger(__name__) diff --git a/flit_core/flit_core/__init__.py b/flit_core/flit_core/__init__.py index d159b36f..0d464a19 100644 --- a/flit_core/flit_core/__init__.py +++ b/flit_core/flit_core/__init__.py @@ -4,4 +4,4 @@ All the convenient development features live in the main 'flit' package. """ -__version__ = '3.5.0' +__version__ = '3.5.1' diff --git a/pyproject.toml b/pyproject.toml index 1fcc9d3f..9a4e8b17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["flit_core >=3.5.0,<4"] +requires = ["flit_core >=3.5.1,<4"] build-backend = "flit_core.buildapi" [project] @@ -8,7 +8,7 @@ authors = [ {name = "Thomas Kluyver", email = "thomas@kluyver.me.uk"}, ] dependencies = [ - "flit_core >=3.5.0", + "flit_core >=3.5.1", "requests", "docutils", "tomli",