Skip to content

Commit cabe14a

Browse files
author
Martin Larralde
committed
Fix find_rust_extension syntax not allowed in Python 2.7
Signed-off-by: Martin Larralde <[email protected]>
1 parent ac5c929 commit cabe14a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

example_tomlgen/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The authors list is generated after the ``author`` and ``author_email`` options
5555
from ``setup.py`` / ``setup.cfg``, but can also be overriden using the
5656
``authors`` key in the ``[tomlgen_rust]`` section of ``setup.cfg``:
5757

58-
.. code-block:: toml
58+
.. code-block:: ini
5959
6060
[tomlgen_rust]
6161
authors =
@@ -108,7 +108,7 @@ add ``Cargo.toml`` and ``Cargo.lock`` to your ``.gitignore`` file.
108108
Then, make sure ``tomlgen_rust`` is run before ``build_rust`` everytime by
109109
adding aliases to your ``setup.cfg`` file:
110110

111-
.. code-block:: toml
111+
.. code-block:: ini
112112
113113
[aliases]
114114
build_rust = tomlgen_rust -f build_rust

setuptools_rust/tomlgen.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def _slugify(name):
159159
slug = [char if char in allowed else '_' for char in name]
160160
return ''.join(slug)
161161

162-
def find_rust_extensions(*directories, libfile="lib.rs", **kwargs):
162+
def find_rust_extensions(*directories, **kwargs):
163163
"""Attempt to find Rust extensions in given directories.
164164
165165
This function will recurse through the directories in the given
@@ -206,9 +206,13 @@ def find_rust_extensions(*directories, libfile="lib.rs", **kwargs):
206206
lib.mylib.rustext => lib/mylib/rustext/Cargo.toml
207207
"""
208208

209+
# Get the file used to mark a Rust extension
210+
libfile = kwargs.get('libfile', 'lib.rs')
211+
212+
# Get the directories to explore
209213
directories = directories or [os.getcwd()]
210-
extensions = []
211214

215+
extensions = []
212216
for directory in directories:
213217
for base, dirs, files in os.walk(directory):
214218
if libfile in files:

0 commit comments

Comments
 (0)