from distutils.core import setup, Extension

MODULES_TO_BUILD = ["fasthash", "suc", "lemmatize"]

for module in MODULES_TO_BUILD:
    setup(
        name=module,
        ext_modules=[
            Extension(
                name=module,
                sources=['%s.c' % module],
                libraries=[],
                extra_compile_args=['-Wall', '-Wno-unused-function'],
                extra_link_args=[]
            )
        ],
        script_args=['build_ext', '--inplace']
    )

from distutils.core import setup, Extension

MODULES_TO_BUILD = ["fasthash", "suc", "lemmatize"]

def main():
    for module in MODULES_TO_BUILD:
        setup(
            name=module,
            ext_modules=[
                Extension(
                    name=module,
                    sources=['%s.c' % module],
                    libraries=[],
                    extra_compile_args=['-Wall', '-Wno-unused-function'],
                    extra_link_args=[]
                )
            ],
            script_args=['build_ext', '--inplace']
        )

if __name__ == '__main__':
    main()

Put module in method to enable calls from libraries.
Put module in method to enable calls from libraries.


Former-commit-id: e614cec07ee71723be5b114163fe835961f6811c
  from distutils.core import setup, Extension
  
  MODULES_TO_BUILD = ["fasthash", "suc", "lemmatize"]
  
+ def main():
- for module in MODULES_TO_BUILD:
+     for module in MODULES_TO_BUILD:
-     setup(
+         setup(
-         name=module,
+             name=module,
-         ext_modules=[
+             ext_modules=[
-             Extension(
+                 Extension(
-                 name=module,
+                     name=module,
-                 sources=['%s.c' % module],
+                     sources=['%s.c' % module],
-                 libraries=[],
+                     libraries=[],
-                 extra_compile_args=['-Wall', '-Wno-unused-function'],
+                     extra_compile_args=['-Wall', '-Wno-unused-function'],
-                 extra_link_args=[]
+                     extra_link_args=[]
+                 )
-             )
+             ],
-         ],
-         script_args=['build_ext', '--inplace']
+             script_args=['build_ext', '--inplace']
-     )
+         )
  
+ if __name__ == '__main__':
+     main()
+ 
Put module in method to enable calls from libraries.
## Code Before:
from distutils.core import setup, Extension

MODULES_TO_BUILD = ["fasthash", "suc", "lemmatize"]

for module in MODULES_TO_BUILD:
    setup(
        name=module,
        ext_modules=[
            Extension(
                name=module,
                sources=['%s.c' % module],
                libraries=[],
                extra_compile_args=['-Wall', '-Wno-unused-function'],
                extra_link_args=[]
            )
        ],
        script_args=['build_ext', '--inplace']
    )

## Instruction:
Put module in method to enable calls from libraries.
## Code After:
from distutils.core import setup, Extension

MODULES_TO_BUILD = ["fasthash", "suc", "lemmatize"]

def main():
    for module in MODULES_TO_BUILD:
        setup(
            name=module,
            ext_modules=[
                Extension(
                    name=module,
                    sources=['%s.c' % module],
                    libraries=[],
                    extra_compile_args=['-Wall', '-Wno-unused-function'],
                    extra_link_args=[]
                )
            ],
            script_args=['build_ext', '--inplace']
        )

if __name__ == '__main__':
    main()
