Selaa lähdekoodia

added cmd interface

Snow 8 vuotta sitten
vanhempi
commit
6b632a4a37
4 muutettua tiedostoa jossa 17 lisäystä ja 12 poistoa
  1. 0 1
      .gitignore
  2. 8 0
      hdpg1d/cmd.py
  3. 1 1
      hdpg1d/solve.py
  4. 8 10
      setup.py

+ 0 - 1
.gitignore

@@ -1 +0,0 @@
-__pycache__/

+ 8 - 0
hdpg1d/cmd.py

@@ -0,0 +1,8 @@
+"""
+command line interface
+"""
+from .solve import run
+
+
+def main():
+    run()

+ 1 - 1
hdpg1d/solve.py

@@ -47,7 +47,7 @@ def run():
     for key, value in sorted(menu.items()):
         print(key, value)
 
-    selection = input("Please Select:")
+    selection = input("Please Select: ")
     if selection == '1':
         hdgCoeff = getCoefficients()
         hdgSolution = HDPG1d(hdgCoeff.nele, hdgCoeff.porder)

+ 8 - 10
setup.py

@@ -1,18 +1,11 @@
 #!/usr/bin/env python
 
-from distutils.core import setup
-import codecs
+from setuptools import setup, find_packages
 import os
 
-here = os.path.abspath(os.path.dirname(__file__))
+# here = os.path.abspath(os.path.dirname(__file__))
 
 
-# def read(*parts):
-#     # intentionally *not* adding an encoding option to open
-#     return codecs.open(os.path.join(here, *parts), 'r').read()
-
-# long_description = read('README.rst')
-
 setup(name='hdpg1d',
       version='1.1.1',
       description='An 1D finite element solver using hybridizable discontinuous\
@@ -21,7 +14,12 @@ setup(name='hdpg1d',
       author_email='[email protected]',
       url='test',
       license='MIT',
-      packages=['hdpg1d'],
+      packages=find_packages(),
+      entry_points={
+          'console_scripts': [
+              'PGsolve = hdpg1d.cmd:main'
+          ],
+      },
       requires=[
           'numpy',
           'matplotlib',