← Back to team overview

oerppy-hackers team mailing list archive

[Branch ~oerppy-hackers/oerppy/trunk] Rev 47: * Added a util function for finding scripts.

 

------------------------------------------------------------
revno: 47
committer: duncan@xxxxxxxxxx
branch nick: trunk
timestamp: Thu 2011-06-09 14:28:52 -0600
message:
  * Added a util function for finding scripts.
  * Renamed the scripts to be unique (starting with the string "oerppy_").
  * Updated the setup.py script to include script installation.
renamed:
  bin/export_all_weeks_timesheets => bin/oerppy_export_all_weeks_timesheets
  bin/export_month_timesheets => bin/oerppy_export_month_timesheets
  bin/export_oem_users => bin/oerppy_export_oem_users
  bin/export_project_names => bin/oerppy_export_project_names
  bin/export_users => bin/oerppy_export_users
  bin/get_table_metadata => bin/oerppy_get_table_metadata
modified:
  oerppy/util.py
  setup.py


--
lp:oerppy
https://code.launchpad.net/~oerppy-hackers/oerppy/trunk

Your team oerppy Hackers is subscribed to branch lp:oerppy.
To unsubscribe from this branch go to https://code.launchpad.net/~oerppy-hackers/oerppy/trunk/+edit-subscription
=== renamed file 'bin/export_all_weeks_timesheets' => 'bin/oerppy_export_all_weeks_timesheets'
=== renamed file 'bin/export_month_timesheets' => 'bin/oerppy_export_month_timesheets'
=== renamed file 'bin/export_oem_users' => 'bin/oerppy_export_oem_users'
=== renamed file 'bin/export_project_names' => 'bin/oerppy_export_project_names'
=== renamed file 'bin/export_users' => 'bin/oerppy_export_users'
=== renamed file 'bin/get_table_metadata' => 'bin/oerppy_get_table_metadata'
=== modified file 'oerppy/util.py'
--- oerppy/util.py	2011-06-09 20:16:40 +0000
+++ oerppy/util.py	2011-06-09 20:28:52 +0000
@@ -1,6 +1,7 @@
 import os
 import calendar
 import datetime
+import glob
 from urlparse import urlparse, urlunparse
 import xmlrpclib
 
@@ -8,6 +9,7 @@
 
 
 MONDAY = 0
+DAY_NOT_IN_MONTH = 0
 
 
 def write_default_config(dest_dir=""):
@@ -154,7 +156,7 @@
     for week in month:
         # days outside of the month are given the value 0; we skip those
         day = week[MONDAY]
-        if day == 0:
+        if day == DAY_NOT_IN_MONTH:
             continue
         monday = _get_date(day)
         if return_iso:
@@ -190,3 +192,11 @@
         if "__init__.py" in files:
             packages.append(directory.replace(os.sep, "."))
     return packages
+
+
+def dist_find_scripts(script_dirs):
+    scripts = []
+    for directory in script_dirs:
+        files = glob.glob(os.path.join(directory, "*"))
+        scripts.extend(files)
+    return scripts

=== modified file 'setup.py'
--- setup.py	2011-06-09 20:16:40 +0000
+++ setup.py	2011-06-09 20:28:52 +0000
@@ -10,4 +10,5 @@
     url=meta.url,
     license=meta.license,
     packages=util.dist_find_packages(meta.library_name),
+    scripts=util.dist_find_scripts(["./bin"])
     )