0

In python, I have some scripts: scritp1.py, script2.py, etc. And some users: user1, user2, etc.

The scripts have some lines equal.

I need pass only one script to each user. I can't use a general module, because each user are in different computer, and I don't have a simple and automatic way to update the module.

but, I can make some similar to concatenate the module to each script...

for each script, how I can get one file with particular script lines and module dependencies ?

JuanPablo
  • 23,792
  • 39
  • 118
  • 164
  • "but, I can make some similar to concatenate the module to each script..." I do not understand this part. – Games Brainiac Oct 15 '13 at 14:37
  • @GamesBrainiac my first idea, with a makefile: concatenate the module to scripts, remove the imports, etc. but I'm searching better options. – JuanPablo Oct 15 '13 at 14:41
  • A better option would be a version control system to distribute the common parts. You can have the selection of what to import based on the username and if you structure your code well then up to 100% can be common. – Steve Barnes Oct 15 '13 at 14:50
  • To clarify 1) script1 goes to user1, script2 goes to user2, etc? 2) Some of the lines in script1, script2, etc. are the same? 3) You are unable to install something like [Salt Stack](http://saltstack.com/) or use [Fabric](http://docs.fabfile.org/) or something similar, that will allow you to deploy scripts? – Wayne Werner Oct 15 '13 at 14:51
  • @WayneWerner 1) yes, script1 goes to user1, etc. 2) some lines are the same, the common code is in functions used for make calculations. 3) I can't use `Fabric`, the user computers have windows, and I don't have administrator permissions. – JuanPablo Oct 15 '13 at 15:00
  • @JuanPablo you don't need administrator permissions, just write access to the folders/files that you want to replace. Alternatively, do these machines have `pip` on them? – Wayne Werner Oct 15 '13 at 15:04
  • @WayneWerner the users don't know how use `pip`. – JuanPablo Oct 15 '13 at 15:16
  • @JuanPablo you could easily write a script using `subprocess` to call pip and install your scripts for them. – Wayne Werner Oct 15 '13 at 15:19
  • @WayneWerner you say: write a `update.py` script for to call pip with subprocess for update the library ... maybe is a option. – JuanPablo Oct 15 '13 at 15:23

0 Answers0